dotnet / dotnet/fsharp

DefaultAugmentation on DU leads to badly generated type

Open
#9,178 20 comments 0 reactions 0 assignees View on GitHub
Area-Compiler-Checking Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

I fell into a pit. exp:
Writting a DU in **Liberary1**:
```
[] // focus on it
type Bar =
| Test1 of int
| Test 2

module Bar =
let inline foo x = // focus on "inline"
match x with
| Test1 x -> x
| Test2 -> 0
```
and then write code in **Liberary2**
```
let foo2 x = Bar.foo x
```
As `foo2` is called, some exception is happend.
Because `DefaultAugmentation false` don't generate property `Tag`, the inline function `foo` use `_tag` for judgment. And when we using `Bar.foo` in another liberary, the code inline to `foo2`. It visit `_tag`, bug it's an internal value...

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.