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)
Net8 fails to build the app with errors specified in the code as comments
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:
Net6/7 output: (compiles and runs)
Net8 fails to build the app with errors specified in the code as comments