diff options
author | Olivier Blanvillain <olivier.blanvillain@gmail.com> | 2016-09-16 10:35:56 +0200 |
---|---|---|
committer | Olivier Blanvillain <olivier.blanvillain@gmail.com> | 2016-09-16 10:45:27 +0200 |
commit | 61f7e085ff1c72eee2b61d708a887ee3a6778167 (patch) | |
tree | 42a5a42e6606f326bbd2576aa1642f67e0ab409c /src/dotty/tools/dotc | |
parent | 5450507c663bca565b2b61b8afb1073c991c9827 (diff) | |
download | dotty-61f7e085ff1c72eee2b61d708a887ee3a6778167.tar.gz dotty-61f7e085ff1c72eee2b61d708a887ee3a6778167.tar.bz2 dotty-61f7e085ff1c72eee2b61d708a887ee3a6778167.zip |
Fix corner case w types ALL passed by name & out of order
This commit removes a problematic duplicated `checkBounds` call on `TypeApply`.
To verify correctness of this change on has to check that `normalizeTree` used only once [1],
and the function using `normalizeTree` already takes care of calling `checkBounds`.
[1]: https://github.com/lampepfl/dotty/blob/0e8f05d88bfef95fac59f522fd9d06792126bd11/src/dotty/tools/dotc/transform/PostTyper.scala#L205
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r-- | src/dotty/tools/dotc/transform/PostTyper.scala | 7 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 2 |
2 files changed, 3 insertions, 6 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) |