From ad6c683596f12a8e868c8c6f8ce2a4855146daca Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 11 Apr 2017 14:12:09 +0200 Subject: Fix #2219: Fix type applications on WildcardType Previously we just returned the unapplied WildcardType which is incorrect if the WildcardType is bounded. The proper thing to do is to do the type application on the bounds of the WildcardType and wrap the result in a WildcardType. --- compiler/src/dotty/tools/dotc/core/TypeApplications.scala | 2 +- tests/pos/i2219.scala | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/pos/i2219.scala diff --git a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala index 82051b66c..b37ed2b0a 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala @@ -429,7 +429,7 @@ class TypeApplications(val self: Type) extends AnyVal { case dealiased: LazyRef => LazyRef(() => dealiased.ref.appliedTo(args)) case dealiased: WildcardType => - dealiased + WildcardType(dealiased.optBounds.appliedTo(args).bounds) case dealiased: TypeRef if dealiased.symbol == defn.NothingClass => dealiased case _ if typParams.isEmpty || typParams.head.isInstanceOf[LambdaParam] => diff --git a/tests/pos/i2219.scala b/tests/pos/i2219.scala new file mode 100644 index 000000000..7f786eb3e --- /dev/null +++ b/tests/pos/i2219.scala @@ -0,0 +1,7 @@ +object Test { + type Inv[T[_]] = T[_] + + class Hi[T[_]](x: Inv[T]) { + def foo[T[_]](value: Inv[T] = x) = {} + } +} -- cgit v1.2.3