-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix/overriding #228
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
Fix/overriding #228
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
productArity is a method defined in ProductN which is inherited from case classes. It is possible that it will be usewd in the implementation of pattern matching in the future. The previous implementation used the same name to mean something else: Not the arity of the case class itself but the arity of the pattern/type it represented. Renaming to prodArity avoids the confusion.
Previously, two denotations with types => T and ()T could not be merged, only their types could be, but then the denotation would no longer be a SymDenotation. We now treat the two types as equivalent so that it will select the symbol in a subclass. This fixes a problem where, once overrding pairs are made to work (see following commit), in core/Types we get an error "overriding final method "hashCode".
OverridingPairs had several bugs which caused pairs to be lost, which caused missing overrides checks. Fixing OverridingPairs revealed several test failures (and a problem in Synthetics generation which was fixed in the last commit). Tests that became negative are all moved into neg/overrides.scala, and the original versions in pos were fixed.
to make it easier to understand.
These may raise real errors, so we cannot exclude them from overriding pairs a priori. But we can avoid reporting any errors if other override errors were reported previously for the same class.
(1) Type arguments now get a coordinate. (2) They are labeled Override (2) avoids having to special case TypeArgs in OverridingPairs.
`override` was not recognized at all on types.
Note that the following: class A
class B
class X {
def f: A = ???
}
class Y extends X {
override def f: B = ???
} Still compiles without any error. |
Somehow this was lost in porting (or was this done somewhere else in scalac?).
Added overriding checks for types, which catch @smarter's last example. |
LGTM with smarter@06ca2b0 or something similar added and a TODO for dotty-staging@387bdf9#commitcomment-8616457 |
Closed
WojciechMazur
pushed a commit
to WojciechMazur/dotty
that referenced
this pull request
May 8, 2025
Backport "No outdent at eof" to 3.3 LTS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes missing overriding checks. Builds on #227. Review by @smarter