summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-01-06 21:23:56 -0800
committerPaul Phillips <paulp@improving.org>2012-01-06 21:51:08 -0800
commita6ebd0f3ee2610ce1f5c3b2aee269ea8b2cfd6df (patch)
treee72e0e2d9b5611fe8892fb2dbcfb4f8312569cd9 /src
parent6a37ada63977e5016204ffa3f325c233d0e342c0 (diff)
downloadscala-a6ebd0f3ee2610ce1f5c3b2aee269ea8b2cfd6df.tar.gz
scala-a6ebd0f3ee2610ce1f5c3b2aee269ea8b2cfd6df.tar.bz2
scala-a6ebd0f3ee2610ce1f5c3b2aee269ea8b2cfd6df.zip
Remedy spurious bounds conformance failure.
Misters hkarg and hkparam have to work harder to see things from the same perspective, so they don't end up in a huff over bounds which were the same all along. Closes SI-5020, review by @moors.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/internal/Kinds.scala10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/compiler/scala/reflect/internal/Kinds.scala b/src/compiler/scala/reflect/internal/Kinds.scala
index 15fcb5f94d..e675be43dc 100644
--- a/src/compiler/scala/reflect/internal/Kinds.scala
+++ b/src/compiler/scala/reflect/internal/Kinds.scala
@@ -110,10 +110,7 @@ trait Kinds {
): List[(Type, Symbol, KindErrors)] = {
// instantiate type params that come from outside the abstract type we're currently checking
- def transform(tp: Type, clazz: Symbol): Type =
- tp.asSeenFrom(pre, clazz)
- def transformedBounds(p: Symbol, o: Symbol) =
- transform(p.info.instantiateTypeParams(tparams, targs).bounds, o)
+ def transform(tp: Type, clazz: Symbol): Type = tp.asSeenFrom(pre, clazz)
// check that the type parameters hkargs to a higher-kinded type conform to the
// expected params hkparams
@@ -131,6 +128,7 @@ trait Kinds {
// @M sometimes hkargs != arg.typeParams, the symbol and the type may
// have very different type parameters
val hkparams = param.typeParams
+
def kindCheck(cond: Boolean, f: KindErrors => KindErrors) {
if (!cond)
kindErrors = f(kindErrors)
@@ -160,8 +158,8 @@ trait Kinds {
// conceptually the same. Could also replace the types by
// polytypes, but can't just strip the symbols, as ordering
// is lost then.
- val declaredBounds = transformedBounds(hkparam, paramowner)
- val declaredBoundsInst = bindHKParams(declaredBounds)
+ val declaredBounds = transform(hkparam.info.instantiateTypeParams(tparams, targs).bounds, paramowner)
+ val declaredBoundsInst = transform(bindHKParams(declaredBounds), owner)
val argumentBounds = transform(hkarg.info.bounds, owner)
kindCheck(declaredBoundsInst <:< argumentBounds, _ strictnessError (hkarg -> hkparam))