dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.91k stars 785 forks source link

Compiler allows us to box a byreflike type, leading to runtime crash #7114

Open cartermp opened 5 years ago

cartermp commented 5 years ago

Consider this program:

open System

[<EntryPoint>]
let main argv =
    let sp = Span<int>.Empty
    let x = sp.GetType()
    printfn "%b" x.IsValueType
    0 // return an integer exit code

Result:

image

Expected:

TIHan commented 5 years ago

Yea, I've been aware of this for a while but never created an issue for it. Should be fairly straightforward to filter out the common functions of an object.