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

IsUnionCaseTester throwing an error #17301

Open
ncave opened this issue Jun 12, 2024 · 0 comments
Open

IsUnionCaseTester throwing an error #17301

ncave opened this issue Jun 12, 2024 · 0 comments
Labels
Area-FCS Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone

Comments

@ncave
Copy link
Contributor

ncave commented Jun 12, 2024

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

@github-actions github-actions bot added this to the Backlog milestone Jun 12, 2024
@abonie abonie added Area-FCS Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. and removed Needs-Triage labels Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-FCS Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Projects
Status: New
Development

No branches or pull requests

2 participants