@@ -1585,6 +1585,19 @@ object Parsers {
15851585 t
15861586 end typ
15871587
1588+ /** TypeBlock ::= {TypeBlockStat semi} Type
1589+ * TypeBlockStat ::= ‘type’ {nl} TypeDcl
1590+ */
1591+ def typeBlock (): Tree =
1592+ val tDefs = new ListBuffer [Tree ]
1593+ while in.token == TYPE do
1594+ val mods = defAnnotsMods(modifierTokens)
1595+ tDefs += typeDefOrDcl(in.offset, in.skipToken(mods))
1596+ acceptStatSep()
1597+ val tpt = typ()
1598+ if tDefs.isEmpty then tpt else Block (tDefs.toList, tpt)
1599+
1600+
15881601 private def makeKindProjectorTypeDef (name : TypeName ): TypeDef = {
15891602 val isVarianceAnnotated = name.startsWith(" +" ) || name.startsWith(" -" )
15901603 // We remove the variance marker from the name without passing along the specified variance at all
@@ -2447,7 +2460,7 @@ object Parsers {
24472460 atSpan(in.skipToken()) {
24482461 withinStaged(StageKind .Quoted | (if (location.inPattern) StageKind .QuotedPattern else 0 )) {
24492462 Quote {
2450- if (in.token == LBRACKET ) inBrackets(typ ())
2463+ if (in.token == LBRACKET ) inBrackets(typeBlock ())
24512464 else stagedBlock()
24522465 }
24532466 }
@@ -3080,8 +3093,8 @@ object Parsers {
30803093 /* -------- PARAMETERS ------------------------------------------- */
30813094
30823095 /** DefParamClauses ::= DefParamClause { DefParamClause } -- and two DefTypeParamClause cannot be adjacent
3083- * DefParamClause ::= DefTypeParamClause
3084- * | DefTermParamClause
3096+ * DefParamClause ::= DefTypeParamClause
3097+ * | DefTermParamClause
30853098 * | UsingParamClause
30863099 */
30873100 def typeOrTermParamClauses (
@@ -3179,7 +3192,7 @@ object Parsers {
31793192 * UsingClsTermParamClause::= ‘(’ ‘using’ [‘erased’] (ClsParams | ContextTypes) ‘)’
31803193 * ClsParams ::= ClsParam {‘,’ ClsParam}
31813194 * ClsParam ::= {Annotation}
3182- *
3195+ *
31833196 * TypelessClause ::= DefTermParamClause
31843197 * | UsingParamClause
31853198 *
@@ -3557,13 +3570,13 @@ object Parsers {
35573570 }
35583571 }
35593572
3560-
3573+
35613574
35623575 /** DefDef ::= DefSig [‘:’ Type] ‘=’ Expr
35633576 * | this TypelessClauses [DefImplicitClause] `=' ConstrExpr
35643577 * DefDcl ::= DefSig `:' Type
35653578 * DefSig ::= id [DefTypeParamClause] DefTermParamClauses
3566- *
3579+ *
35673580 * if clauseInterleaving is enabled:
35683581 * DefSig ::= id [DefParamClauses] [DefImplicitClause]
35693582 */
@@ -3602,8 +3615,8 @@ object Parsers {
36023615 val mods1 = addFlag(mods, Method )
36033616 val ident = termIdent()
36043617 var name = ident.name.asTermName
3605- val paramss =
3606- if in.featureEnabled(Feature .clauseInterleaving) then
3618+ val paramss =
3619+ if in.featureEnabled(Feature .clauseInterleaving) then
36073620 // If you are making interleaving stable manually, please refer to the PR introducing it instead, section "How to make non-experimental"
36083621 typeOrTermParamClauses(ParamOwner .Def , numLeadParams = numLeadParams)
36093622 else
@@ -3613,7 +3626,7 @@ object Parsers {
36133626 joinParams(tparams, vparamss)
36143627
36153628 var tpt = fromWithinReturnType { typedOpt() }
3616-
3629+
36173630 if (migrateTo3) newLineOptWhenFollowedBy(LBRACE )
36183631 val rhs =
36193632 if in.token == EQUALS then
0 commit comments