Skip to content

No diagnostic about static member in object expression#16277

Merged
vzarytovskii merged 12 commits into
dotnet:mainfrom
edgarfgp:not-diagnostic-about-static-member-in-object-expression
Nov 21, 2023
Merged

No diagnostic about static member in object expression#16277
vzarytovskii merged 12 commits into
dotnet:mainfrom
edgarfgp:not-diagnostic-about-static-member-in-object-expression

Conversation

@edgarfgp

@edgarfgp edgarfgp commented Nov 14, 2023

Copy link
Copy Markdown
Contributor

Follow-up: #16250.

  • Object expressions should skip checking for non-instance members.
  • Implementing static members which will be unusable at the instance level.

@edgarfgp edgarfgp closed this Nov 15, 2023
@edgarfgp edgarfgp reopened this Nov 15, 2023
@edgarfgp edgarfgp marked this pull request as ready for review November 16, 2023 12:39
@edgarfgp edgarfgp requested a review from a team as a code owner November 16, 2023 12:39
@edgarfgp

Copy link
Copy Markdown
Contributor Author

This is ready

Comment thread src/Compiler/Checking/MethodOverrides.fs Outdated
Co-authored-by: Adam Boniecki <20281641+abonie@users.noreply.github.com>

@psfinaki psfinaki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So looks like IWSAMs are fine? Thanks for the extra testing :)

Comment thread tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj Outdated
@edgarfgp

Copy link
Copy Markdown
Contributor Author

So looks like IWSAMs are fine? Thanks for the extra testing :)

Yes and added more tests in my last commit.

@edgarfgp

Copy link
Copy Markdown
Contributor Author

As discussed with @vzarytovskii This PR:

  • Avoid checking for static members in object expressions. As this can NOT be used on an instance
  • Reuses error 3860 with an updated message to prevent runtime errors when an object expression attempts to implement an interfaces with static abstract members.

@vzarytovskii vzarytovskii merged commit d41a0d7 into dotnet:main Nov 21, 2023
@vzarytovskii

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants