diff options
author | Martin Odersky <odersky@gmail.com> | 2016-12-19 16:35:48 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-12-20 18:33:45 +0100 |
commit | dbdb123ae7180b66e5d29ad4dd89b746641a3457 (patch) | |
tree | a150e8f6e74fcb123f504386ea899627f679b048 /compiler/src | |
parent | 1fec473169c1705d61c6a0d85efb14f25ba1cd43 (diff) | |
download | dotty-dbdb123ae7180b66e5d29ad4dd89b746641a3457.tar.gz dotty-dbdb123ae7180b66e5d29ad4dd89b746641a3457.tar.bz2 dotty-dbdb123ae7180b66e5d29ad4dd89b746641a3457.zip |
Fix subtyping of hk types with wildcard arguments
Argument comparison of hk types did not take into account that
the compared types could have themselves wildcard arguments.
Diffstat (limited to 'compiler/src')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/TypeComparer.scala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 334306f19..8930983f3 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -757,8 +757,14 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { if (args1.isEmpty) args2.isEmpty else args2.nonEmpty && { val v = tparams.head.paramVariance - (v > 0 || isSubType(args2.head, args1.head)) && - (v < 0 || isSubType(args1.head, args2.head)) + def isSub(tp1: Type, tp2: Type) = tp2 match { + case tp2: TypeBounds => + tp2.contains(tp1) + case _ => + (v > 0 || isSubType(tp2, tp1)) && + (v < 0 || isSubType(tp1, tp2)) + } + isSub(args1.head, args2.head) } && isSubArgs(args1.tail, args2.tail, tparams) /** Test whether `tp1` has a base type of the form `B[T1, ..., Tn]` where |