Skip to content

Commit 4153fea

Browse files
authored
Merge pull request #14638 from Xavientois/use-scala3-enum-for-param-owner
Fix safe-init error in ParamOwner
2 parents 6dc591a + ee9b83e commit 4153fea

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ object Parsers {
4949
case InBlock extends Location(false, false, false)
5050
case ElseWhere extends Location(false, false, false)
5151

52-
@sharable object ParamOwner extends Enumeration {
53-
val Class, Type, TypeParam, Def: Value = Value
54-
}
52+
enum ParamOwner:
53+
case Class, Type, TypeParam, Def
5554

5655
type StageKind = Int
5756
object StageKind {
@@ -2927,7 +2926,7 @@ object Parsers {
29272926
* HkTypeParamClause ::= ‘[’ HkTypeParam {‘,’ HkTypeParam} ‘]’
29282927
* HkTypeParam ::= {Annotation} [‘+’ | ‘-’] (id [HkTypePamClause] | ‘_’) TypeBounds
29292928
*/
2930-
def typeParamClause(ownerKind: ParamOwner.Value): List[TypeDef] = inBrackets {
2929+
def typeParamClause(ownerKind: ParamOwner): List[TypeDef] = inBrackets {
29312930

29322931
def variance(vflag: FlagSet): FlagSet =
29332932
if ownerKind == ParamOwner.Def || ownerKind == ParamOwner.TypeParam then
@@ -2962,7 +2961,7 @@ object Parsers {
29622961
commaSeparated(() => typeParam())
29632962
}
29642963

2965-
def typeParamClauseOpt(ownerKind: ParamOwner.Value): List[TypeDef] =
2964+
def typeParamClauseOpt(ownerKind: ParamOwner): List[TypeDef] =
29662965
if (in.token == LBRACKET) typeParamClause(ownerKind) else Nil
29672966

29682967
/** ContextTypes ::= FunArgType {‘,’ FunArgType}

0 commit comments

Comments
 (0)