@@ -2899,9 +2899,8 @@ self =>
28992899 val name = ident()
29002900 val tstart = in.offset
29012901 atPos(start, if (name == nme.ERROR ) start else nameOffset) {
2902- val mods1 = if (in.token == SUBTYPE ) mods | Flags .DEFERRED else mods
2903- val template = templateOpt(mods1, name, NoMods , Nil , tstart)
2904- ModuleDef (mods1, name.toTermName, template)
2902+ val template = templateOpt(mods, name, NoMods , Nil , tstart)
2903+ ModuleDef (mods, name.toTermName, template)
29052904 }
29062905 }
29072906
@@ -3003,13 +3002,17 @@ self =>
30033002
30043003 /** {{{
30053004 * ClassTemplateOpt ::= `extends' ClassTemplate | [[`extends'] TemplateBody]
3006- * TraitTemplateOpt ::= TraitExtends TraitTemplate | [[`extends' ] TemplateBody] | `<:' TemplateBody
3007- * TraitExtends ::= `extends' | `<:'
3005+ * TraitTemplateOpt ::= TraitExtends TraitTemplate | [[TraitExtends ] TemplateBody]
3006+ * TraitExtends ::= `extends' | `<:' (deprecated)
30083007 * }}}
30093008 */
30103009 def templateOpt (mods : Modifiers , name : Name , constrMods : Modifiers , vparamss : List [List [ValDef ]], tstart : Offset ): Template = {
3010+ def deprecatedUsage (): Boolean = {
3011+ deprecationWarning(in.offset, " Using `<:` for `extends` is deprecated" , since = " 2.12.5" )
3012+ true
3013+ }
30113014 val (parents, self, body) = (
3012- if (in.token == EXTENDS || in.token == SUBTYPE && mods.isTrait) {
3015+ if (in.token == EXTENDS || in.token == SUBTYPE && mods.isTrait && deprecatedUsage() ) {
30133016 in.nextToken()
30143017 template()
30153018 }
@@ -3230,11 +3233,12 @@ self =>
32303233 * }}}
32313234 */
32323235 def blockStatSeq (): List [Tree ] = checkNoEscapingPlaceholders {
3236+ def acceptStatSepOptOrEndCase () = if (! isCaseDefEnd) acceptStatSepOpt()
32333237 val stats = new ListBuffer [Tree ]
32343238 while (! isStatSeqEnd && ! isCaseDefEnd) {
32353239 if (in.token == IMPORT ) {
32363240 stats ++= importClause()
3237- acceptStatSepOpt ()
3241+ acceptStatSepOptOrEndCase ()
32383242 }
32393243 else if (isDefIntro || isLocalModifier || isAnnotation) {
32403244 if (in.token == IMPLICIT ) {
@@ -3244,11 +3248,11 @@ self =>
32443248 } else {
32453249 stats ++= localDef(0 )
32463250 }
3247- acceptStatSepOpt ()
3251+ acceptStatSepOptOrEndCase ()
32483252 }
32493253 else if (isExprIntro) {
32503254 stats += statement(InBlock )
3251- if ( ! isCaseDefEnd) acceptStatSep ()
3255+ acceptStatSepOptOrEndCase ()
32523256 }
32533257 else if (isStatSep) {
32543258 in.nextToken()
0 commit comments