Skip to content

Commit 9c0d0dd

Browse files
committed
Show 'no parens' in valid cases only
1 parent 9c5e216 commit 9c0d0dd

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
@@ -1264,10 +1264,16 @@ object messages {
12641264

12651265
val kind = "Reference"
12661266

1267-
val explanation =
1268-
hl"""|You have specified more parameter lists as defined in the method definition(s).
1269-
|In case ${err.refStr(methPartType)} is defined without parenthesis, you may
1267+
private val noParameters = if (methPartType.widenSingleton.isInstanceOf[ExprType])
1268+
hl"""|As ${err.refStr(methPartType)} is defined without parenthesis, you may
12701269
|not use any at call-site, either.
12711270
|"""
1271+
else
1272+
""
1273+
1274+
val explanation =
1275+
s"""|You have specified more parameter lists as defined in the method definition(s).
1276+
|$noParameters""".stripMargin
1277+
12721278
}
12731279
}

0 commit comments

Comments
 (0)