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

Add "sealed" keyword to sealed interface signatures #3001

Closed
wants to merge 3 commits into from

Conversation

IgnatBeresnev
Copy link
Member

Fixes #2994

Comment on lines +1067 to +1083
private fun MemberDescriptor.modifier(): KotlinModifier {
val isInterface = this is ClassDescriptor && this.kind == ClassKind.INTERFACE
return if (isInterface) {
when (modality) {
// modifiers other than "sealed" are redundant for interfaces
Modality.SEALED -> KotlinModifier.Sealed
else -> KotlinModifier.Empty
}
} else {
when (modality) {
Modality.FINAL -> KotlinModifier.Final
Modality.SEALED -> KotlinModifier.Sealed
Modality.OPEN -> KotlinModifier.Open
Modality.ABSTRACT -> KotlinModifier.Abstract
else -> KotlinModifier.Empty
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This particular bit could certainly be improved, but it's going to be re-written to K2 anyway, and I'd like to minimize merge conflicts with the refactoring I'm doing in a neighbouring branch.

@qwwdfsad qwwdfsad requested a review from vmishenev June 20, 2023 09:39
private fun PsiModifierListOwner.getModifier(): JavaModifier {
val isInterface = this is PsiClass && this.isInterface
if (isInterface) {
return JavaModifier.Empty // all Java modifiers are redundant for interfaces
Copy link
Member

Choose a reason for hiding this comment

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

Nitpicking: The comment is a little confusing. Interfaces can have an access modifier.

@IgnatBeresnev
Copy link
Member Author

This PR is too outdated, it's easier to re-implement it than trying to rebase and merge the conflicts.

@IgnatBeresnev IgnatBeresnev deleted the sealed-interface-keyword branch December 12, 2023 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sealed interface is not rendered as sealed
2 participants