Skip to content

Perform language version check for an implicit implementation of a static virtual member#61601

Merged
AlekseyTs merged 2 commits intodotnet:mainfrom
AlekseyTs:Issue61598
Jun 1, 2022
Merged

Perform language version check for an implicit implementation of a static virtual member#61601
AlekseyTs merged 2 commits intodotnet:mainfrom
AlekseyTs:Issue61598

Conversation

@AlekseyTs
Copy link
Copy Markdown
Contributor

Fixes #61598.

GetInterfaceLocation(interfaceMember, implementingType),
implicitImpl, interfaceMember, implementingType);
LanguageVersion requiredVersion = MessageID.IDS_FeatureStaticAbstractMembersInInterfaces.RequiredVersion();
LanguageVersion? availableVersion = implementingType.DeclaringCompilation?.LanguageVersion;
Copy link
Copy Markdown
Member

@RikkiGibson RikkiGibson May 31, 2022

Choose a reason for hiding this comment

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

In which scenarios does the implementing type lack a declaring compilation? Maybe only in EE? #Resolved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In which scenarios does the implementing type lack a declaring compilation? Maybe only in EE?

Types not declared in source do not have declaring compilation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't realize that these checks could occur when the implementing type isn't declared in source. Could you please point out a test where the implementing type is not declared in source?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn't realize that these checks could occur when the implementing type isn't declared in source. Could you please point out a test where the implementing type is not declared in source?

The FindImplementationForInterfaceMember API can be called on any type and it might potentially get here for a type that is not declared is source. I don't think I specifically test for a diagnostics like this in those cases because the diagnostics is simply getting dropped, even if reported. StaticAbstractMembersInInterfacesTests call FindImplementationForInterfaceMember API in various scenarios for source and non-source symbols, as well as other tests utilizing the API.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That makes complete sense, thanks.

@AlekseyTs AlekseyTs requested a review from a team June 1, 2022 14:41
@AlekseyTs
Copy link
Copy Markdown
Contributor Author

@333fred, @dotnet/roslyn-compiler For the second review

@AlekseyTs AlekseyTs merged commit dc866ed into dotnet:main Jun 1, 2022
@ghost ghost added this to the Next milestone Jun 1, 2022
@RikkiGibson RikkiGibson modified the milestones: Next, 17.3 P3 Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language version check is missing for an implicit implementation of a static virtual member

3 participants