File tree 4 files changed +28
-1
lines changed
test/dotty/tools/dotc/reporting 4 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ public enum ErrorMessageID {
61
61
AmbiguousOverloadID ,
62
62
ReassignmentToValID ,
63
63
TypeDoesNotTakeParametersID ,
64
+ ParameterizedTypeLacksArgumentsID ,
64
65
;
65
66
66
67
public int errorNumber () {
Original file line number Diff line number Diff line change @@ -1326,4 +1326,14 @@ object messages {
1326
1326
|declared to take any.
1327
1327
| """
1328
1328
}
1329
+
1330
+ case class ParameterizedTypeLacksArguments (psym : Symbol )(implicit ctx : Context )
1331
+ extends Message (ParameterizedTypeLacksArgumentsID ) {
1332
+ val msg = hl " parameterized $psym lacks argument list "
1333
+ val kind = " Reference"
1334
+ val explanation =
1335
+ hl """ The $psym is declared with non-implicit parameters, you may not leave
1336
+ |out the parameter list when extending it.
1337
+ | """
1338
+ }
1329
1339
}
Original file line number Diff line number Diff line change @@ -1286,7 +1286,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1286
1286
case cinfo : MethodType =>
1287
1287
if (! ctx.erasedTypes) { // after constructors arguments are passed in super call.
1288
1288
typr.println(i " constr type: $cinfo" )
1289
- ctx.error(em " parameterized $ psym lacks argument list " , ref.pos)
1289
+ ctx.error(ParameterizedTypeLacksArguments ( psym) , ref.pos)
1290
1290
}
1291
1291
ref
1292
1292
case _ =>
Original file line number Diff line number Diff line change @@ -457,4 +457,20 @@ class ErrorMessagesTests extends ErrorMessagesTest {
457
457
assertEquals(" WithOutParams" , tpe.show)
458
458
}
459
459
460
+ @ Test def parameterizedTypeLacksParameters =
461
+ checkMessagesAfter(" frontend" ) {
462
+ """
463
+ |trait WithParams(s: String)
464
+ |class Extending extends WithParams
465
+ """ .stripMargin
466
+ }
467
+ .expect { (ictx, messages) =>
468
+ implicit val ctx : Context = ictx
469
+ val defn = ictx.definitions
470
+
471
+ assertMessageCount(1 , messages)
472
+ val ParameterizedTypeLacksArguments (symbol) :: Nil = messages
473
+ assertEquals(" trait WithParams" , symbol.show)
474
+ }
475
+
460
476
}
You can’t perform that action at this time.
0 commit comments