Skip to content

Commit 3e9bb9f

Browse files
committed
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
1 parent d6cc101 commit 3e9bb9f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/transform/TreeChecker.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class TreeChecker extends Phase with SymTransformer {
141141
override def apply(parent: Tree, tree: Tree)(using Context): Tree = {
142142
tree match {
143143
case tree: New if !parent.isInstanceOf[tpd.Select] =>
144-
assert(assertion = false, i"`New` node must be wrapped in a `Select`:\n parent = ${parent.show}\n child = ${tree.show}")
144+
assert(assertion = false, i"`New` node must be wrapped in a `Select` of the constructor:\n parent = ${parent.show}\n child = ${tree.show}")
145145
case _: Annotated =>
146146
// Don't check inside annotations, since they're allowed to contain
147147
// somewhat invalid trees.

0 commit comments

Comments
 (0)