-
Notifications
You must be signed in to change notification settings - Fork 832
Closed
Labels
Area-Compiler-Syntaxlexfilter, indentation and parsinglexfilter, indentation and parsingBugImpact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.(Internal MS Team use only) Describes an issue with extreme impact on existing code.Regression
Milestone
Description
Please provide a succinct description of the issue.
I've found a case where compiler is not able to compile the code it used to compile before.
This particular flavor of pattern macthing is used to help compiler figure out some overload complexities
Repro steps
Provide the steps required to reproduce the problem:
open System
module Repro =
let fail1() =
let x: Result<unit, exn> = Error (NullReferenceException())
match x with
| Error (_: exn & :? System.NullReferenceException) -> // Unexpected symbol ':?' in pattern (FS0010)
printfn "NullRef!"
| _ ->
()
let fail2() =
let x: Result<unit, exn> = Error (Exception())
match x with
| Error (_: exn & (:? System.NullReferenceException)) -> // Constraint intersection syntax may only be used with flexible types, e.g. '#IDisposable & #ISomeInterface'. (FS3572)
printfn "NullRef"
| _ ->
printfn "Not a NullRef"
Repro.fail1()
Repro.fail2()Net6/7 output: (compiles and runs)
NullRef!
Not a NullRef
Net8 fails to build the app with errors specified in the code as comments
blair55 and Xyncgas
Metadata
Metadata
Assignees
Labels
Area-Compiler-Syntaxlexfilter, indentation and parsinglexfilter, indentation and parsingBugImpact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.(Internal MS Team use only) Describes an issue with extreme impact on existing code.Regression
Type
Projects
Status
Done