Skip to content

Commit 9e87840

Browse files
committed
Avoid misleading tree: Name
This lets you think that `tree.name` is sensible tho it isn't, and for more than an year (since ce333b1).
1 parent 6f53e62 commit 9e87840

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,26 +1260,26 @@ object messages {
12601260
|""".stripMargin
12611261
}
12621262

1263-
case class OverloadedOrRecursiveMethodNeedsResultType(tree: Names.TermName)(implicit ctx: Context)
1263+
case class OverloadedOrRecursiveMethodNeedsResultType(method: Names.TermName)(implicit ctx: Context)
12641264
extends Message(OverloadedOrRecursiveMethodNeedsResultTypeID) {
12651265
val kind = "Syntax"
1266-
val msg = hl"""overloaded or recursive method ${tree} needs return type"""
1266+
val msg = hl"""overloaded or recursive method ${method} needs return type"""
12671267
val explanation =
1268-
hl"""Case 1: ${tree} is overloaded
1269-
|If there are multiple methods named `${tree}` and at least one definition of
1268+
hl"""Case 1: ${method} is overloaded
1269+
|If there are multiple methods named `${method}` and at least one definition of
12701270
|it calls another, you need to specify the calling method's return type.
12711271
|
1272-
|Case 2: ${tree} is recursive
1273-
|If `${tree}` calls itself on any path, you need to specify its return type.
1272+
|Case 2: ${method} is recursive
1273+
|If `${method}` calls itself on any path, you need to specify its return type.
12741274
|""".stripMargin
12751275
}
12761276

1277-
case class RecursiveValueNeedsResultType(tree: Names.TermName)(implicit ctx: Context)
1277+
case class RecursiveValueNeedsResultType(value: Names.TermName)(implicit ctx: Context)
12781278
extends Message(RecursiveValueNeedsResultTypeID) {
12791279
val kind = "Syntax"
1280-
val msg = hl"""recursive value ${tree} needs type"""
1280+
val msg = hl"""recursive value ${value} needs type"""
12811281
val explanation =
1282-
hl"""The definition of `${tree}` is recursive and you need to specify its type.
1282+
hl"""The definition of `${value}` is recursive and you need to specify its type.
12831283
|""".stripMargin
12841284
}
12851285

0 commit comments

Comments
 (0)