aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeComparer.scala10
-rw-r--r--tests/pos/hkwild.scala6
2 files changed, 14 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
diff --git a/tests/pos/hkwild.scala b/tests/pos/hkwild.scala
new file mode 100644
index 000000000..49bea7d01
--- /dev/null
+++ b/tests/pos/hkwild.scala
@@ -0,0 +1,6 @@
+class Test[T1](val x: T1) {
+ def invert[El1, CC1[X]](implicit w1: T1 <:< CC1[El1]) = {
+ val buf: CC1[_] = w1(x)
+ ???
+ }
+}