Skip to content

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

Merged
merged 4 commits into from
Jan 6, 2016

Conversation

DarkDimius
Copy link
Contributor

@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.

override def derivedSelect(prefix: Type)(implicit ctx: Context): Type =
if (prefix eq this.prefix) this
else {
???
Copy link
Contributor

Choose a reason for hiding this comment

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

???

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@DarkDimius DarkDimius self-assigned this Jan 3, 2016
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.
@DarkDimius
Copy link
Contributor Author

@odersky please have a look and merge if LGT you.

@odersky
Copy link
Contributor

odersky commented Jan 6, 2016

LGTM.

odersky added a commit that referenced this pull request Jan 6, 2016
Subtle changes to TypeComarer needed for Linker.
@odersky odersky merged commit 66e73e0 into scala:master Jan 6, 2016
@retronym
Copy link
Member

retronym commented Jan 7, 2016

For the record, I was working in this space in scalac recently: scala/scala@2.12.x...retronym:ticket/9542-combo

@allanrenucci allanrenucci deleted the linker/types branch December 14, 2017 19:23
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.

5 participants