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

Support public, internal, private, static, virtual, sealed, abstract, and extern modifiers with interface events. #19080

Conversation

AlekseyTs
Copy link
Contributor

@dotnet/roslyn-compiler Please review.

… and extern modifiers with interface events.
Assert.False(p01.IsSealed);
Assert.False(p01.IsStatic);
Assert.False(p01.IsExtern);
Assert.False(p01.IsOverride);
Copy link
Member

Choose a reason for hiding this comment

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

Please consider adding a VerifyModifiers(MethodSymbol, DeclarationModifiers) helper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened an issue #19116.

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM, but I agree with Chuck that investing in some test helpers would be worth it and will help with readability.

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review, need a second sign-off.

@@ -80,6 +80,11 @@ internal SourceFieldLikeEventSymbol(SourceMemberContainerTypeSymbol containingTy
// Don't initialize this.type - we'll just use the type of the field (which is lazy and handles var)
}

if (inInterfaceType && !this.IsAbstract && !this.IsExtern)
{
diagnostics.Add(ErrorCode.ERR_EventNeedsBothAccessors, this.Locations[0], this);
Copy link
Member

Choose a reason for hiding this comment

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

Why is this an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is this an error?

Because non-abstract, non-extern events should declare both accessors with implementation.

ValidateAccessor(p1.AddMethod);
ValidateAccessor(p1.RemoveMethod);

void ValidateAccessor(MethodSymbol acessor)
Copy link
Member

Choose a reason for hiding this comment

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

Typo: accessor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typo: accessor

Thanks, will fix throughout the file in the next PR.

System.Console.WriteLine(""get_P1"");
}
remove

Copy link
Member

Choose a reason for hiding this comment

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

Typo: accessor

@cston
Copy link
Member

cston commented May 1, 2017

LGTM

@AlekseyTs AlekseyTs merged commit 484929d into dotnet:features/DefaultInterfaceImplementation May 1, 2017
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.

4 participants