Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Apr 13, 2015

Alternative to #471. Add a separate phase that checks that abstract classes are not instantiated and that self types conform.

This is probably easier to understand than #471 because the flow is concentrated in one tree traversal instead of being indirectly established by adding attachments to trees and looking at them.

Review by @DarkDimius

odersky added 7 commits April 13, 2015 16:04
Now prints `C{...}` instead of `$anon`.
The self type as given (or implied for module classes) in the source.
Also defined and updated for normal types, not just ClassInfo types.
Common functionality between this and baseTypeWithArgs has been pulled
into RefinedType#wrapIfMember.
Check that the self type of a class conforms to the self types of its parent classes.
- Abstract classes cannot be instantiated (exceptions:
  parent news and Java annotations)
- Instantiateed class must conform to its self type.
Java compilation units should not be retained after typer,
as no code will be generated for them. All we need from
them are their symbols.
An error message might be suppressed because it contains internal code. But
if it is the first one, we should still print it. Otherwise, we risk a scenario where
we see "2 errors" but none is printed.
@odersky odersky mentioned this pull request Apr 13, 2015
We saw a failure of accessing a denotation outside its defined interval, which got triggered
by i"...". This should never be the case. We should be more interested in what i"..." has to print.

(V2, to see whether this builds with Travis now)
@odersky odersky force-pushed the alt/instantiation-checks branch from ee09bea to 35717b7 Compare April 13, 2015 15:28
@odersky
Copy link
Contributor Author

odersky commented Apr 13, 2015

Travis failed with timeout before. I repushed the last commit with only the message edited to retrigger Travis (is there a better way to do so?) and now it passes.

@odersky odersky closed this Apr 13, 2015
@odersky odersky reopened this Apr 13, 2015
DarkDimius added a commit that referenced this pull request Apr 20, 2015
@DarkDimius DarkDimius merged commit e3449e9 into scala:master Apr 20, 2015
@allanrenucci allanrenucci deleted the alt/instantiation-checks branch December 14, 2017 16:58
tgodzik added a commit to tgodzik/scala3 that referenced this pull request Jul 23, 2025
Backport "Unhelpful error message when trying to use named extraction, when not matching case class or named tuple" to 3.3 LTS
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.

2 participants