aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala29
1 files changed, 1 insertions, 28 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 6510ba35b..745eee8f8 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -848,34 +848,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
val args1 = args.zipWithConserve(tparams)(typedArg(_, _)).asInstanceOf[List[Tree]]
// check that arguments conform to bounds is done in phase PostTyper
- val tree1 = assignType(cpy.AppliedTypeTree(tree)(tpt1, args1), tpt1, args1)
- if (tree1.tpe.isHKApply)
- for (arg @ TypeBoundsTree(_, _) <- args1)
- ctx.error("illegal wildcard type argument; does not correspond to type parameter of a class", arg.pos)
- // The reason for outlawing such arguments is illustrated by the following example.
- // Say we have
- //
- // type RMap[A, B] = Map[B, A]
- //
- // Then
- //
- // Rmap[_, Int]
- //
- // translates to
- //
- // Lambda$I { type hk$0; type hk$1 = Int; type $apply = Map[$hk1, $hk0] } # $apply
- //
- // Let's call the last type T. You would expect that
- //
- // Map[Int, String] <: RMap[_, Int]
- //
- // But that's not the case given the standard subtyping rules. In fact, the rhs reduces to
- //
- // Map[Int, T # $hk0]
- //
- // That means the second argument to `Map` is unknown and String is certainly not a subtype of it.
- // To avoid the surprise we outlaw problematic wildcard arguments from the start.
- tree1
+ assignType(cpy.AppliedTypeTree(tree)(tpt1, args1), tpt1, args1)
}
}