-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Subtle changes to TypeComarer needed for Linker. #1004
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
Conversation
Linker needs to resolve super calls before they are rewritten in the tree.
override def derivedSelect(prefix: Type)(implicit ctx: Context): Type = | ||
if (prefix eq this.prefix) this | ||
else { | ||
??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In linker this didn't yet happen: the prefix that this type starts with is very precise type and it should not loose precision by getting less precise prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this happens, I would need to start looking into changes to derivedSelect from #1001
Motivation comes from Linker: List$.canBuildFrom is implemented as ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]] static type of field ReusableCBF here is TypeRef(TypeRef(List$), GenericCanBuildFrom[Nothing]) but the ident ReusableCBF gets type TypeRef(ThisType(List$), GenericCanBuildFrom[Nothing]) We already permit comparisons between static TermRefs and ThisTypes, this change additionally allows TypeRefs to static modules to become subtypes of ThisTypes of static modules.
9714565
to
f0c6814
Compare
@odersky please have a look and merge if LGT you. |
LGTM. |
Subtle changes to TypeComarer needed for Linker.
For the record, I was working in this space in scalac recently: scala/scala@2.12.x...retronym:ticket/9542-combo |
@odersky those are the changes that are result of our discussion last Friday.
Only 9714565 is new here, it allows NamedTypes to static modules to be subtypes
of ThisTypes of static modules. This was already allowed for TermRefs.
The commit comment has a motivation example from stdlib.
@odersky please review.