Skip to content
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

SI-8244 Fix raw type regression under separate compilation #3519

Merged
merged 1 commit into from Feb 13, 2014

Conversation

adriaanm
Copy link
Contributor

[Rebase of #3483 that also avoids overlapping test files t8244b/ became t8244e/]

In #1901, handling of raw types encountered in signatures during class
file parsing was changed to work in the same manner as
classExistentialType, by using
existentialAbstraction(cls.tparms, cls.tpe_*)

But this never creates fresh existential symbols, and just sticks
the class type parameters it quantified:

scala> trait T[A <: String]
defined trait T

scala> val cls = typeOf[T[_]].typeSymbol
cls = trait T#101864

scala> cls.typeParams
res0 = List(type A#101865)

scala> cls.tpe_*
res1 = T#101864[A#101865]

scala> classExistentialType(cls)
res3 = T#101864[_ <: String#7209]

scala> val ExistentialType(quantified, result) = res3
List(type A#101865)

In the enclosed test case, this class type parameter was substituted
during typeOf[X] memberType sym, which led us unsoundly thinking
that Raw[_] was Raw[X].

I've added a TODO comment to review the other usages of
classExistentialType.

Test variations include joint and separate compilation, and the
corresponding Scala-only code. All fail with type errors now,
as we expect. I've also added a distillation of a bootstrap
error that failed when I forgot to wrap the existentialType.

In scala#1901, handling of raw types encountered in signatures during class
file parsing was changed to work in the same manner as
`classExistentialType`, by using
`existentialAbstraction(cls.tparms, cls.tpe_*)`

But this never creates fresh existential symbols, and just sticks
the class type parameters it `quantified`:

	scala> trait T[A <: String]
	defined trait T

	scala> val cls = typeOf[T[_]].typeSymbol
	cls = trait T#101864

	scala> cls.typeParams
	res0 = List(type A#101865)

	scala> cls.tpe_*
	res1 = T#101864[A#101865]

	scala> classExistentialType(cls)
	res3 = T#101864[_ <: String#7209]

	scala> val ExistentialType(quantified, result) = res3
	List(type A#101865)

In the enclosed test case, this class type parameter was substituted
during `typeOf[X] memberType sym`, which led us unsoundly thinking
that `Raw[_]` was `Raw[X]`.

I've added a TODO comment to review the other usages of
`classExistentialType`.

Test variations include joint and separate compilation, and the
corresponding Scala-only code. All fail with type errors now,
as we expect. I've also added a distillation of a bootstrap
error that failed when I forgot to wrap the `existentialType`.
@adriaanm
Copy link
Contributor Author

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants