dotnet / dotnet/fsharp

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

Open
#7,114 1 comment 1 reaction 0 assignees View on GitHub
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:

![image](https://user-images.githubusercontent.com/6309070/60620421-04a0a880-9d90-11e9-90ce-fbb07013b6a2.png)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.