Skip to content

IsUnionCaseTester throwing an error #17301

@ncave

Description

@ncave

2 issues with IsUnionCaseTester:

  • Seems to be throwing an error, instead of returning false on non-matching values.
  • Seems to be missing a case where an union case tester method is neither IsProperty nor IsMethod (but it is IsPropertyGetterMethod).

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>.

Metadata

Metadata

Assignees

Labels

Area-FCSBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

Type

No type
No fields configured for issues without a type.

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions