File tree 2 files changed +15
-3
lines changed
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -1898,7 +1898,7 @@ object Parsers {
1898
1898
else EmptyTree
1899
1899
}
1900
1900
else {
1901
- if (! isExprIntro) syntaxError(" missing return type " , in.lastOffset)
1901
+ if (! isExprIntro) syntaxError(MissingReturnType () , in.lastOffset)
1902
1902
accept(EQUALS )
1903
1903
expr()
1904
1904
}
Original file line number Diff line number Diff line change @@ -275,10 +275,10 @@ object messages {
275
275
276
276
val explanation = " "
277
277
}
278
-
278
+
279
279
case class EarlyDefinitionsNotSupported ()(implicit ctx: Context ) extends Message (9 ) {
280
280
val kind = " Syntax"
281
-
281
+
282
282
val msg = " early definitions are not supported; use trait parameters instead"
283
283
284
284
val code1 =
@@ -500,4 +500,16 @@ object messages {
500
500
|which cannot start with ${Red (illegalToken)}. """ .stripMargin
501
501
}
502
502
}
503
+
504
+ case class MissingReturnType ()(implicit ctx: Context ) extends Message (18 ) {
505
+ val kind = " Syntax"
506
+ val msg = " missing return type"
507
+ val explanation =
508
+ hl """ An abstract declaration must have a return type. For example:
509
+ |
510
+ |trait Shape {
511
+ | def area: Double // abstract declaration returning a ${" Double" }
512
+ |} """ .stripMargin
513
+ }
514
+
503
515
}
You can’t perform that action at this time.
0 commit comments