-
Notifications
You must be signed in to change notification settings - Fork 844
Open
Labels
Area-Compiler-SRTPbugs in SRTP inference, resolution, witness passing, code genbugs in SRTP inference, resolution, witness passing, code genBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Description
Repro steps
Write the following F# program, and run it:
let inline toString (x: ^a) =
(^a : (member ToString : unit -> string) x)
[<EntryPoint>]
let main argv =
let s = toString 123
printfn "%s" s
0Expected behavior
This program should print a string 123.
Actual behavior
This program throws a NullReferenceException:
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at Program.main(String[] argv) in T:\Temp\ConsoleApp12\ConsoleApp12\Program.fs:line 6
It works on reference types though.
Known workarounds
Do not use an inline function there.
Related information
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.100\
Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6dbSzer, inosik, auduchinok and abelbraaksmaLiminiens
Metadata
Metadata
Assignees
Labels
Area-Compiler-SRTPbugs in SRTP inference, resolution, witness passing, code genbugs in SRTP inference, resolution, witness passing, code genBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Type
Projects
Status
New