Skip to content

Commit

Permalink
Improve New/Select -Ycheck message
Browse files Browse the repository at this point in the history
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 scala#16357
  • Loading branch information
nicolasstucki committed Jan 23, 2023
1 parent d6cc101 commit 3e9bb9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/TreeChecker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3e9bb9f

Please sign in to comment.