Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 115cffe

Browse files
committedApr 11, 2017
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.
1 parent 92a9d05 commit 115cffe

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
 

‎compiler/src/dotty/tools/dotc/core/TypeApplications.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class TypeApplications(val self: Type) extends AnyVal {
429429
case dealiased: LazyRef =>
430430
LazyRef(() => dealiased.ref.appliedTo(args))
431431
case dealiased: WildcardType =>
432-
dealiased
432+
WildcardType(dealiased.optBounds.appliedTo(args).asInstanceOf[TypeBounds])
433433
case dealiased: TypeRef if dealiased.symbol == defn.NothingClass =>
434434
dealiased
435435
case _ if typParams.isEmpty || typParams.head.isInstanceOf[LambdaParam] =>

‎tests/pos/i2219.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
object Test {
2+
type Inv[T[_]] = T[_]
3+
4+
class Hi[T[_]](x: Inv[T]) {
5+
def foo[T[_]](value: Inv[T] = x) = {}
6+
}
7+
}

0 commit comments

Comments
 (0)
Please sign in to comment.