File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
compiler/src/dotty/tools/dotc/parsing
tests/pos-custom-args/erased Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -2910,12 +2910,12 @@ object Parsers {
29102910
29112911 /** ContextTypes ::= Type {‘,’ Type}
29122912 */
2913- def contextTypes (ofClass : Boolean , nparams : Int ): List [ValDef ] =
2913+ def contextTypes (ofClass : Boolean , nparams : Int , impliedMods : Modifiers ): List [ValDef ] =
29142914 val tps = commaSeparated(typ)
29152915 var counter = nparams
29162916 def nextIdx = { counter += 1 ; counter }
29172917 val paramFlags = if ofClass then Private | Local | ParamAccessor else Param
2918- tps.map(makeSyntheticParameter(nextIdx, _, paramFlags | Synthetic | Given ))
2918+ tps.map(makeSyntheticParameter(nextIdx, _, paramFlags | Synthetic | impliedMods.flags ))
29192919
29202920 /** ClsParamClause ::= ‘(’ [‘erased’] ClsParams ‘)’ | UsingClsParamClause
29212921 * UsingClsParamClause::= ‘(’ ‘using’ [‘erased’] (ClsParams | ContextTypes) ‘)’
@@ -3016,7 +3016,7 @@ object Parsers {
30163016 || startParamTokens.contains(in.token)
30173017 || isIdent && (in.name == nme.inline || in.lookahead.isColon())
30183018 if isParams then commaSeparated(() => param())
3019- else contextTypes(ofClass, nparams)
3019+ else contextTypes(ofClass, nparams, impliedMods )
30203020 checkVarArgsRules(clause)
30213021 clause
30223022 }
Original file line number Diff line number Diff line change 1+ import scala .language .experimental .erasedDefinitions
2+
3+ type X
4+ erased def x : X = compiletime.erasedValue
5+
6+ def foo (using erased X ): Unit = ()
7+
8+ def test : Unit = foo(using x)
You can’t perform that action at this time.
0 commit comments