Compiler allows us to box a byreflike type, leading to runtime crash
Open
Area-Compiler-Checking
Area-Compiler-Checking-Byref
Bug
Impact-Medium
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
Consider this program:
```fsharp
open System
[]
let main argv =
let sp = Span.Empty
let x = sp.GetType()
printfn "%b" x.IsValueType
0 // return an integer exit code
```
Result:

Expected:
* This should fail to compiler
* IntelliSense should also not suggest things like `GetType()` in the completion list (ref: https://github.com/dotnet/roslyn/issues/35178)
Contributor guide
Assessment
This issue has not been assessed yet.