Skip to content

Add overriding check #11133

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

Merged
merged 1 commit into from
Jan 18, 2021
Merged

Add overriding check #11133

merged 1 commit into from
Jan 18, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 15, 2021

In a situation like

class A { type T = B }
class B extends A { override type T }

We only checked that T in A correctly overrides T in B, since T in A
is taken to be the overriding member, since it is concrete. But we also have to check
the reverse.

This replaces a more specialized treatment where we checked that final members
in Object could not be overridden by abstract members in traits. I removed a bunch
of tests that all tested variations of that other check, and changed the check
file for one representative.

Fixes #11130

In a situation like
```
class A { type T = B }
class B extends A { override type T }
```

We only checked that `T` in `A` correctly overrides `T` in `B`, since `T` in `A`
is taken to be the overriding member, since it is abstract. But we also have to check
the reverse.

This replaces a more specialized treatment where we checked that final members
in `Object` could not be overridden by abstract members in traits. I removed a bunch
of tests that all tested variations of that other check, and changed the check
file for one representative.

Fixes scala#11130
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@liufengyun liufengyun merged commit 723cf3b into scala:master Jan 18, 2021
@liufengyun liufengyun deleted the fix-#11130 branch January 18, 2021 13:28
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

Allowing to override an abstract type member with equality may be unsound in some cases
3 participants