Skip to content

Commit 7519e6e

Browse files
committed
Show 'no parens' in valid cases only
1 parent c7d92ba commit 7519e6e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,10 +1235,16 @@ object messages {
12351235

12361236
val kind = "Reference"
12371237

1238-
val explanation =
1239-
hl"""|You have specified more parameter lists as defined in the method definition(s).
1240-
|In case ${err.refStr(methPartType)} is defined without parenthesis, you may
1238+
private val noParameters = if (methPartType.widenSingleton.isInstanceOf[ExprType])
1239+
hl"""|As ${err.refStr(methPartType)} is defined without parenthesis, you may
12411240
|not use any at call-site, either.
12421241
|""".stripMargin
1242+
else
1243+
""
1244+
1245+
val explanation =
1246+
s"""|You have specified more parameter lists as defined in the method definition(s).
1247+
|$noParameters""".stripMargin
1248+
12431249
}
12441250
}

0 commit comments

Comments
 (0)