Skip to content

Add sealed option to mayHaveCommonChild #17194

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

Closed
wants to merge 1 commit into from
Closed

Conversation

Decel
Copy link
Contributor

@Decel Decel commented Mar 31, 2023

Should fix #16899

@@ -1995,7 +1995,7 @@ object SymDenotations {
* @return The result may contain false positives, but never false negatives.
*/
final def mayHaveCommonChild(that: ClassSymbol)(using Context): Boolean =
!this.is(Final) && !that.is(Final) && (this.is(Trait) || that.is(Trait)) ||
!this.isOneOf(FinalOrSealed) && !that.isOneOf(FinalOrSealed) && (this.is(Trait) || that.is(Trait)) ||
Copy link
Member

Choose a reason for hiding this comment

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

That's not valid, because the following hierarchy is allowed:

sealed trait A
sealed trait B
class C extends A with B

@Decel Decel closed this May 7, 2023
@Decel Decel deleted the i16899 branch May 7, 2023 13:24
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.

Wrong warning on matching union types
2 participants