File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1623,7 +1623,7 @@ object Parsers {
1623
1623
val mod = atPos(in.skipToken()) { Mod .Type () }
1624
1624
(mods | Param | ParamAccessor ).withAddedMod(mod)
1625
1625
} else {
1626
- if (mods.hasFlags) syntaxError(" `type' expected " )
1626
+ if (mods.hasFlags) syntaxError(TypeParamsTypeExpected (mods, ident()) )
1627
1627
mods | Param | PrivateLocal
1628
1628
}
1629
1629
}
Original file line number Diff line number Diff line change @@ -677,5 +677,18 @@ object messages {
677
677
|
678
678
| $fixedVarInAlternative""" .stripMargin
679
679
}
680
+ }
681
+
682
+ case class TypeParamsTypeExpected (mods : Modifiers , identifier : TermName )(implicit ctx : Context ) extends Message (24 ) {
683
+ val kind = " Syntax"
684
+
685
+ val msg = hl """ Expected ${" type" } keyword for type parameter $identifier"""
686
+
687
+ val explanation = hl """ |This happens when you add modifiers like ${" private" } or ${" protected" }
688
+ |to your type parameter definition without adding the ${" type" } keyword.
689
+ |
690
+ |Add ${" type" } to your code, e.g.:
691
+ | ${s " trait A[ ${mods.flags} type $identifier] " }
692
+ | """ .stripMargin
680
693
}
681
694
}
You can’t perform that action at this time.
0 commit comments