From 3e9bb9f2361c52e8cc56254d9af6f6051dfcba15 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 23 Jan 2023 09:22:22 +0100 Subject: [PATCH] Improve `New`/`Select` -Ycheck message We mention that the constructor must be selected. This should be all the information needed in case someone writes a buggy macro that does not include the `Select` around the `New`. Closed #16357 --- compiler/src/dotty/tools/dotc/transform/TreeChecker.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala index 4573c40df78b..2daac7cdd604 100644 --- a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -141,7 +141,7 @@ class TreeChecker extends Phase with SymTransformer { override def apply(parent: Tree, tree: Tree)(using Context): Tree = { tree match { case tree: New if !parent.isInstanceOf[tpd.Select] => - assert(assertion = false, i"`New` node must be wrapped in a `Select`:\n parent = ${parent.show}\n child = ${tree.show}") + assert(assertion = false, i"`New` node must be wrapped in a `Select` of the constructor:\n parent = ${parent.show}\n child = ${tree.show}") case _: Annotated => // Don't check inside annotations, since they're allowed to contain // somewhat invalid trees.