File tree 2 files changed +11
-3
lines changed
compiler/src/dotty/tools/dotc/parsing
tests/pos-custom-args/erased
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -2910,12 +2910,12 @@ object Parsers {
2910
2910
2911
2911
/** ContextTypes ::= Type {‘,’ Type}
2912
2912
*/
2913
- def contextTypes (ofClass : Boolean , nparams : Int ): List [ValDef ] =
2913
+ def contextTypes (ofClass : Boolean , nparams : Int , impliedMods : Modifiers ): List [ValDef ] =
2914
2914
val tps = commaSeparated(typ)
2915
2915
var counter = nparams
2916
2916
def nextIdx = { counter += 1 ; counter }
2917
2917
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 ))
2919
2919
2920
2920
/** ClsParamClause ::= ‘(’ [‘erased’] ClsParams ‘)’ | UsingClsParamClause
2921
2921
* UsingClsParamClause::= ‘(’ ‘using’ [‘erased’] (ClsParams | ContextTypes) ‘)’
@@ -3016,7 +3016,7 @@ object Parsers {
3016
3016
|| startParamTokens.contains(in.token)
3017
3017
|| isIdent && (in.name == nme.inline || in.lookahead.isColon())
3018
3018
if isParams then commaSeparated(() => param())
3019
- else contextTypes(ofClass, nparams)
3019
+ else contextTypes(ofClass, nparams, impliedMods )
3020
3020
checkVarArgsRules(clause)
3021
3021
clause
3022
3022
}
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