@@ -230,6 +230,11 @@ object Parsers {
230
230
else (staged & StageKind .Quoted ) != 0
231
231
}
232
232
233
+ extension (td : TokenData = in)
234
+ def isErased : Boolean =
235
+ td.token == ERASED
236
+ || td.isIdent(nme.erased) && featureEnabled(Feature .erasedTerms)
237
+
233
238
/* ------------- ERROR HANDLING ------------------------------------------- */
234
239
235
240
/** The offset of the last time when a statement on a new line was definitely
@@ -1377,7 +1382,7 @@ object Parsers {
1377
1382
functionRest(Nil )
1378
1383
}
1379
1384
else {
1380
- imods = modifiers(funTypeArgMods )
1385
+ if in.isErased then imods = addModifier(imods )
1381
1386
val paramStart = in.offset
1382
1387
val ts = funArgType() match {
1383
1388
case Ident (name) if name != tpnme.WILDCARD && in.token == COLON =>
@@ -1864,7 +1869,7 @@ object Parsers {
1864
1869
1865
1870
def expr (location : Location ): Tree = {
1866
1871
val start = in.offset
1867
- def isSpecialClosureStart = in.lookahead.token == ERASED
1872
+ def isSpecialClosureStart = in.lookahead.isErased
1868
1873
if in.token == IMPLICIT then
1869
1874
closure(start, location, modifiers(BitSet (IMPLICIT )))
1870
1875
else if in.token == LPAREN && isSpecialClosureStart then
@@ -2096,7 +2101,7 @@ object Parsers {
2096
2101
Nil
2097
2102
else
2098
2103
var mods1 = mods
2099
- if in.token == ERASED then mods1 = addModifier(mods1)
2104
+ if in.isErased then mods1 = addModifier(mods1)
2100
2105
try
2101
2106
commaSeparated(() => binding(mods1))
2102
2107
finally
@@ -2695,6 +2700,7 @@ object Parsers {
2695
2700
case SEALED => Mod .Sealed ()
2696
2701
case IDENTIFIER =>
2697
2702
name match {
2703
+ case nme.erased if featureEnabled(Feature .erasedTerms) => Mod .Erased ()
2698
2704
case nme.inline => Mod .Inline ()
2699
2705
case nme.opaque => Mod .Opaque ()
2700
2706
case nme.open => Mod .Open ()
@@ -2778,8 +2784,6 @@ object Parsers {
2778
2784
normalize(loop(start))
2779
2785
}
2780
2786
2781
- val funTypeArgMods : BitSet = BitSet (ERASED )
2782
-
2783
2787
/** Wrap annotation or constructor in New(...).<init> */
2784
2788
def wrapNew (tpt : Tree ): Select = Select (New (tpt), nme.CONSTRUCTOR )
2785
2789
@@ -2902,10 +2906,13 @@ object Parsers {
2902
2906
def addParamMod (mod : () => Mod ) = impliedMods = addMod(impliedMods, atSpan(in.skipToken()) { mod() })
2903
2907
2904
2908
def paramMods () =
2905
- if in.token == IMPLICIT then addParamMod(() => Mod .Implicit ())
2909
+ if in.token == IMPLICIT then
2910
+ addParamMod(() => Mod .Implicit ())
2906
2911
else
2907
- if isIdent(nme.using) then addParamMod(() => Mod .Given ())
2908
- if in.token == ERASED then addParamMod(() => Mod .Erased ())
2912
+ if isIdent(nme.using) then
2913
+ addParamMod(() => Mod .Given ())
2914
+ if in.isErased then
2915
+ addParamMod(() => Mod .Erased ())
2909
2916
2910
2917
def param (): ValDef = {
2911
2918
val start = in.offset
0 commit comments