fsharp
fsharp copied to clipboard
IsUnionCaseTester throwing an error
2 issues with IsUnionCaseTester:
- Seems to be throwing an error, instead of returning
falseon non-matching values. - Seems to be missing a case where an union case tester method is neither
IsPropertynorIsMethod(but it isIsPropertyGetterMethod).
Perhaps it's missing the | V v -> ... case, maybe something like this?
member _.IsUnionCaseTester =
checkIsResolved()
match d with
| P p -> p.IsUnionCaseTester
| M m -> m.IsUnionCaseTester
| V v -> v.IsPropertyGetterMethod && v.LogicalName.StartsWith("get_Is") // or something like it
| E _ | C _ -> false // fixed to return boolean
Related to #16341
Tested on .NET 8.0, with <LangVersion>preview</LangVersion>.