-
Notifications
You must be signed in to change notification settings - Fork 833
Closed
Description
The compiler shipped with .NET 8.0.100 fails to compile code containing discriminated unions annotated with [<Struct>] and [<DefaultAugmentation(false)>] (error MethodDefNotFound) . Non-struct DUs do not have this problem.
Repro steps
module Test
[<Struct>]
[<DefaultAugmentation(false)>]
type Foo =
| Baz of int
| Bar
member x.IsBaz =
match x with | Baz _ -> true | _ -> false
member x.IsBar =
not x.IsBaz
[<EntryPoint>]
let main argv =
let foo = Baz 42
printfn "%A" foo
0Expected behavior
Should compile.
Actual behavior
Fails with
error FS2014: A problem occurred writing the binary 'D:\test\obj\Debug\net6.0\test.dll': Error in pass3 for type Test, error: Error in GetMethodRefAsMethodDefIdx for mref = ("NewBaz", "Foo"), error: MethodDefNotFound
Related information
- Windows 10
- .NET 8.0.100 SDK
T-Gro