aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-04-11 14:12:09 +0200
committerGuillaume Martres <smarter@ubuntu.com>2017-04-11 15:01:35 +0200
commitad6c683596f12a8e868c8c6f8ce2a4855146daca (patch)
tree27319d8a4d45cf389796abd7a1be7fe862839e33
parent92a9d05fd64ac97140aa0f01214c4738526383c3 (diff)
downloaddotty-ad6c683596f12a8e868c8c6f8ce2a4855146daca.tar.gz
dotty-ad6c683596f12a8e868c8c6f8ce2a4855146daca.tar.bz2
dotty-ad6c683596f12a8e868c8c6f8ce2a4855146daca.zip
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.
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeApplications.scala2
-rw-r--r--tests/pos/i2219.scala7
2 files changed, 8 insertions, 1 deletions
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) = {}
+ }
+}