Skip to content

Fix safe-init error in ParamOwner #14638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ object Parsers {
case InBlock extends Location(false, false, false)
case ElseWhere extends Location(false, false, false)

@sharable object ParamOwner extends Enumeration {
val Class, Type, TypeParam, Def: Value = Value
}
enum ParamOwner:
case Class, Type, TypeParam, Def

type StageKind = Int
object StageKind {
Expand Down Expand Up @@ -2927,7 +2926,7 @@ object Parsers {
* HkTypeParamClause ::= ‘[’ HkTypeParam {‘,’ HkTypeParam} ‘]’
* HkTypeParam ::= {Annotation} [‘+’ | ‘-’] (id [HkTypePamClause] | ‘_’) TypeBounds
*/
def typeParamClause(ownerKind: ParamOwner.Value): List[TypeDef] = inBrackets {
def typeParamClause(ownerKind: ParamOwner): List[TypeDef] = inBrackets {

def variance(vflag: FlagSet): FlagSet =
if ownerKind == ParamOwner.Def || ownerKind == ParamOwner.TypeParam then
Expand Down Expand Up @@ -2962,7 +2961,7 @@ object Parsers {
commaSeparated(() => typeParam())
}

def typeParamClauseOpt(ownerKind: ParamOwner.Value): List[TypeDef] =
def typeParamClauseOpt(ownerKind: ParamOwner): List[TypeDef] =
if (in.token == LBRACKET) typeParamClause(ownerKind) else Nil

/** ContextTypes ::= FunArgType {‘,’ FunArgType}
Expand Down