diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-09-06 10:30:58 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-09-06 10:30:58 -0700 |
commit | 930c85d6c96507d798d1847ea078eebf93dc0acb (patch) | |
tree | dcdcbe51a942026ef24e832f71bb91b9e36f7e4b /src/compiler/scala/tools/nsc/typechecker | |
parent | 4f9851d1fdbad7c5584931935e138b16d20ac478 (diff) | |
parent | 00e46b3dbcea2b72fd3941b7ffc2efba382871e9 (diff) | |
download | scala-930c85d6c96507d798d1847ea078eebf93dc0acb.tar.gz scala-930c85d6c96507d798d1847ea078eebf93dc0acb.tar.bz2 scala-930c85d6c96507d798d1847ea078eebf93dc0acb.zip |
Merge pull request #1187 from retronym/ticket/3577
Better handling of BoundedWildcardType
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 16 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Variances.scala | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 71d352345b..93a8dfc9cb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -896,13 +896,15 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R * the type occurs itself at variance position given by `variance` */ def validateVariance(tp: Type, variance: Int): Unit = tp match { - case ErrorType => ; - case WildcardType => ; - case NoType => ; - case NoPrefix => ; - case ThisType(_) => ; - case ConstantType(_) => ; - // case DeBruijnIndex(_, _) => ; + case ErrorType => + case WildcardType => + case BoundedWildcardType(bounds) => + validateVariance(bounds, variance) + case NoType => + case NoPrefix => + case ThisType(_) => + case ConstantType(_) => + // case DeBruijnIndex(_, _) => case SingleType(pre, sym) => validateVariance(pre, variance) case TypeRef(pre, sym, args) => diff --git a/src/compiler/scala/tools/nsc/typechecker/Variances.scala b/src/compiler/scala/tools/nsc/typechecker/Variances.scala index b9f2b9abd8..279096bddd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Variances.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Variances.scala @@ -67,6 +67,8 @@ trait Variances { def varianceInType(tp: Type)(tparam: Symbol): Int = tp match { case ErrorType | WildcardType | NoType | NoPrefix | ThisType(_) | ConstantType(_) => VARIANCES + case BoundedWildcardType(bounds) => + varianceInType(bounds)(tparam) case SingleType(pre, sym) => varianceInType(pre)(tparam) case TypeRef(pre, sym, args) => |