diff options
author | Martin Odersky <odersky@gmail.com> | 2015-10-20 09:47:21 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-10-24 10:34:51 +0200 |
commit | a415ca1ab713f92788262057d9810d937dc7499a (patch) | |
tree | 309b87812b05d0be733b09abdd78b2ecfb7b6c3b /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 87098e63c2796387c598513a2af2d8f2d1aae91b (diff) | |
download | dotty-a415ca1ab713f92788262057d9810d937dc7499a.tar.gz dotty-a415ca1ab713f92788262057d9810d937dc7499a.tar.bz2 dotty-a415ca1ab713f92788262057d9810d937dc7499a.zip |
Allow existential types in hk types
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 29 |
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) } } |