Skip to content

Commit e9f4189

Browse files
committed
Check all user written definitions for _* return types
1 parent bdfc9e8 commit e9f4189

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ trait Checking {
940940

941941
/** Check that the signature of the class mamber does not return a repeated parameter type */
942942
def checkSignatureRepeatedParam(sym: Symbol)(implicit ctx: Context): Unit =
943-
if (sym.maybeOwner.isClass && sym.info.finalResultType.isRepeatedParam)
943+
if (!sym.isOneOf(Synthetic | InlineProxy | Param) && sym.info.finalResultType.isRepeatedParam)
944944
ctx.error(em"Cannot return repeated parameter type ${sym.info.finalResultType}", sym.sourcePos)
945945

946946
/** Verify classes extending AnyVal meet the requirements */

tests/neg/i7972.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
object O {
22
def m1(a: Int*) = (a: _*) // error: Cannot return repeated parameter type Int*
33
def m2(a: Int*) = { // error: Cannot return repeated parameter type Int*
4-
val b = (a: _*)
4+
val b = (a: _*) // error: Cannot return repeated parameter type Int*
55
b
66
}
77
def m3(a: Int*): Any = {
8-
val b = (a: _*) // Ok, does not affect the signature
8+
val b = (a: _*) // error: Cannot return repeated parameter type Int*
99
b
1010
}
1111
def m4(a: 2*) = (a: _*) // error: Cannot return repeated parameter type Int*

0 commit comments

Comments
 (0)