Skip to content

FS0073 internal error when compiling an exception type with a property with an explicit getter #13658

Closed

Description

@chrisvanderpennen

This appears to be a regression between core sdk 6.0.302 and 6.0.400 on Linux. The following builds with sdk 6.0.302:

 exception CustomException of details: string
     with
         member self.Details with get (): string = self.details

On 6.0.400, it fails with the following error:

❯ cat test.fsx
 exception CustomException of details: string
     with
         member self.Details with get (): string = self.details
❯ dotnet fsi test.fsx


/home/chrisv/code/test.fsx(3,10): error FS0073: internal error: Unexpected definition (GetSetMember
   (Some
      (SynBinding
         (None, Normal, false, false, [],
          PreXmlMerge
  (PreXmlDoc ((3,9), FSharp.Compiler.Xml.XmlDocCollector), PreXmlDocEmpty),
          SynValData
            (Some
               { IsInstance = true
                 IsDispatchSlot = false
                 IsOverrideOrExplicitImpl = false
                 IsFinal = false
                 MemberKind = PropertyGet
                 Trivia =
                  { MemberRange = Some /home/chrisv/code/test.fsx (3,9--3,15)
                    OverrideRange = None
                    AbstractRange = None
                    StaticRange = None
                    DefaultRange = None } },
             SynValInfo
               ([[SynArgInfo ([], false, None)]; []],
                SynArgInfo ([], false, None)), None),
          LongIdent
            (SynLongIdent
               ([self; Details], [/home/chrisv/code/test.fsx (3,20--3,21)],
                [None; None]), Some get, None,
             Pats
               [Paren
                  (Const (Unit, /home/chrisv/code/test.fsx (3,38--3,40)),
                   /home/chrisv/code/test.fsx (3,38--3,40))], None,
             /home/chrisv/code/test.fsx (3,34--3,40)),
          Some
            (SynBindingReturnInfo
               (LongIdent (SynLongIdent ([string], [], [None])),
                /home/chrisv/code/test.fsx (3,42--3,48), [])),
          Typed
            (LongIdent
               (false,
                SynLongIdent
                  ([self; details], [/home/chrisv/code/test.fsx (3,55--3,56)],
                   [None; None]), None, /home/chrisv/code/test.fsx (3,51--3,63)),
             LongIdent (SynLongIdent ([string], [], [None])),
             /home/chrisv/code/test.fsx (3,51--3,63)),
          /home/chrisv/code/test.fsx (3,34--3,40), NoneAtInvisible,
          { LetKeyword = None
            EqualsRange = Some /home/chrisv/code/test.fsx (3,49--3,50) })), None,
    /home/chrisv/code/test.fsx (3,9--3,63),
    { WithKeyword = /home/chrisv/code/test.fsx (3,29--3,33)
      GetKeyword = Some /home/chrisv/code/test.fsx (3,34--3,37)
      AndKeyword = None
      SetKeyword = None }),
 ContainerInfo
  (Parent FSI_0001,
   Some
     (MemberOrValContainerInfo (CustomException, None, None, NoSafeInitInfo, []))))

This also fails when added to Program.fs from dotnet new console --language f#.

Known workarounds

Removing the explicit getter declaration prevents the issue from being encountered:

exception CustomException of details: string with
    member self.Details: string = self.details

Related information

❯ dotnet fsi --version
Microsoft (R) F# Interactive version 12.0.4.0 for F# 6.0
❯ dotnet --list-sdks
6.0.400 [/usr/share/dotnet/sdk]
❯ uname -a
Linux redacted 5.15.57.1-microsoft-standard-WSL2 #1 SMP Wed Jul 27 02:20:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal

I have git bisect running to try and narrow this down, I'll update when it completes.

Activity

  1. vzarytovskii commented on Aug 10, 2022

    @vzarytovskii
    Member

    @nojaf does this ring a bell to you by any chance?
    I remember you were doing something around getters/setters?

    Update: #13435 and #13420

  2. nojaf commented on Aug 10, 2022

    @nojaf
    Contributor

    Yes, let me take a look at that.

  3. chrisvanderpennen commented on Aug 10, 2022

    @chrisvanderpennen
    Author

    Appreciate the fast fix! <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions