diff options
-rw-r--r-- | src/dotty/tools/dotc/transform/PostTyper.scala | 7 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 2 | ||||
-rw-r--r-- | tests/pos/t1513b.scala | 11 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/transform/PostTyper.scala b/src/dotty/tools/dotc/transform/PostTyper.scala index fd22a0ad9..e74709282 100644 --- a/src/dotty/tools/dotc/transform/PostTyper.scala +++ b/src/dotty/tools/dotc/transform/PostTyper.scala @@ -93,7 +93,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran * * should behave differently. * - * O1.x should have the same effect as { println("43"; 42 } + * O1.x should have the same effect as { println("43"); 42 } * * whereas * @@ -103,10 +103,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran * purity of the prefix unless the selection goes to an inline val. */ private def normalizeTree(tree: Tree)(implicit ctx: Context): Tree = tree match { - case tree: TypeTree => tree - case TypeApply(fn, args) => - Checking.checkBounds(args, fn.tpe.widen.asInstanceOf[PolyType]) - tree + case _: TypeTree | _: TypeApply => tree case _ => if (tree.isType) { Checking.typeChecker.traverse(tree) diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index d77520c77..101974b32 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -37,7 +37,7 @@ object Checking { * well as for AppliedTypeTree nodes. Also checks that type arguments to * *-type parameters are fully applied. */ - def checkBounds(args: List[tpd.Tree], boundss: List[TypeBounds], instantiate: (Type, List[Type]) => Type)(implicit ctx: Context) = { + def checkBounds(args: List[tpd.Tree], boundss: List[TypeBounds], instantiate: (Type, List[Type]) => Type)(implicit ctx: Context): Unit = { (args, boundss).zipped.foreach { (arg, bound) => if (!bound.isHK && arg.tpe.isHK) ctx.error(ex"missing type parameter(s) for $arg", arg.pos) diff --git a/tests/pos/t1513b.scala b/tests/pos/t1513b.scala index 881187be0..546649383 100644 --- a/tests/pos/t1513b.scala +++ b/tests/pos/t1513b.scala @@ -1,5 +1,9 @@ object Test { - def f[T1 <: String, T2 <: Int, T3 <: Boolean](a1: T1, a2: T2, a3: T3) = () + def f[ + T1 <: String, + T2 <: Int, + T3 <: Boolean + ](a1: T1, a2: T2, a3: T3) = () f ("", 1, true) f[T1 = String] ("", 1, true) @@ -12,5 +16,10 @@ object Test { f[T3 = Boolean, T2 = Int] ("", 1, true) f[T3 = Boolean, T1 = String] ("", 1, true) f[T1 = String, T2 = Int, T3 = Boolean]("", 1, true) + f[T1 = String, T3 = Boolean, T2 = Int] ("", 1, true) + f[T2 = Int, T1 = String, T3 = Boolean]("", 1, true) + f[T2 = Int, T3 = Boolean, T1 = String] ("", 1, true) + f[T3 = Boolean, T1 = String, T2 = Int] ("", 1, true) + f[T3 = Boolean, T2 = Int, T1 = String] ("", 1, true) f[String, Int, Boolean] ("", 1, true) } |