Skip to content

internal error: no 'value__' field found for enumeration type when rec module & enum constraint & type alias #14580

@Booksbaum

Description

@Booksbaum

Repro & Behaviour

module rec MyModule

type MyEnum =
  | Alpha = 1
  | Beta = 2
type MyInter<'TEnum when 'TEnum : enum<int>> = interface end

type MyAlias = MyInter<MyEnum>

(Fable repl)

produces compiler error: (on MyEnum in type MyEnum =)

error FS0073: internal error: no 'value__' field found for enumeration type MyEnum

Expected behaviour: should compile without any errors

Additional info:

  • Same behaviour for namespace rec instead of module rec (repl)
  • It does compile without rec (module (repl), namespace (repl))
  • It does compile without enum constraints (repl)
  • Same error when used in interface or class inheritance (interface (repl), class (repl))
  • It does compile when MyInter<MyEnum> is used in other places (like type annotation) (repl)
  • It does compile when Enum & Alias are in different modules (-> not in same rec module) (repl)

Known workarounds

  • Don't use rec module/namespace
  • Extract Enum or its usage into different module
  • Don't use enum constraint

Related information

  • dotnet --version: 7.0.101
    (linked examples (Fable repl): whatever FCS version Fable: 4.0.0-theta-008 is based on)

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI-thinks-issue-fixedArea-Compiler-CheckingType checking, attributes and all aspects of logic checkingArea-Compiler-SRTPbugs in SRTP inference, resolution, witness passing, code genBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions