Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal error of single case active pattern within let binding #16856

Open
Tangent-90 opened this issue Mar 11, 2024 · 1 comment
Open

Internal error of single case active pattern within let binding #16856

Tangent-90 opened this issue Mar 11, 2024 · 1 comment
Labels
Area-Compiler-Checking Type checking, attributes and all aspects of logic checking Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

Comments

@Tangent-90
Copy link
Contributor

图片

Repro steps

Input following code into fsi:

let (|T|) (f: _ -> _) = ();;
match id with T -> ();;
let (T) = id;;

Expected behavior

Both works.

Actual behavior

let way doesn't work.

Known workarounds

Use match.

Related information

Provide any related information (optional):

  • Operating system: Windows 11
  • .NET Runtime kind (.NET Core, .NET Framework, Mono): .NET 9.0.100-preview.1.24101.2
  • Editing Tools (e.g. Visual Studio Version, Visual Studio): Microsoft (R) F# Interactive version F# 8.0 的 12.8.300.0
@github-actions github-actions bot added this to the Backlog milestone Mar 11, 2024
@Tangent-90 Tangent-90 changed the title Inconsistance behavior of single case active pattern in match and let Internal error of single case active pattern within let binding Mar 11, 2024
@abonie abonie added Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. Area-Compiler-Checking Type checking, attributes and all aspects of logic checking and removed Needs-Triage labels Mar 18, 2024
@edgarfgp
Copy link
Contributor

edgarfgp commented Mar 27, 2024

Looking into this. I think this should not throw an internal error. Found a workaround to make this compile adding unit -> unit

let (|T|) (f: _ -> _) = ()
match id with T -> ()
let (T: unit -> unit) = id

Edit: this will also avoid the internal error

let (|T|) (f: unit -> unit) = f()
match id with T -> ()
let (T) = id


let (|T|) f = f()
match id with T c -> c
let (T) = id

cc @vzarytovskii

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compiler-Checking Type checking, attributes and all aspects of logic checking Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
Status: New
Development

No branches or pull requests

3 participants