File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -2310,15 +2310,22 @@ object Parsers {
23102310 /** ImportSelectors ::= `{' {ImportSelector `,'} FinalSelector ‘}’
23112311 * FinalSelector ::= ImportSelector
23122312 * | ‘_’
2313- * | ‘for’ InfixType
2313+ * | ‘for’ InfixType {‘,’ InfixType}
23142314 */
23152315 def importSelectors (): List [Tree ] = in.token match {
23162316 case USCORE =>
23172317 wildcardIdent() :: Nil
23182318 case FOR =>
23192319 if (! importImplied)
23202320 syntaxError(em " `for` qualifier only allowed in `import implied` " )
2321- atSpan(in.skipToken()) { TypeBoundsTree (EmptyTree , infixType()) } :: Nil
2321+ atSpan(in.skipToken()) {
2322+ var t = infixType()
2323+ while (in.token == COMMA ) {
2324+ val op = atSpan(in.skipToken()) { Ident (tpnme.raw.BAR ) }
2325+ t = InfixOp (t, op, infixType())
2326+ }
2327+ TypeBoundsTree (EmptyTree , t)
2328+ } :: Nil
23222329 case _ =>
23232330 importSelector() :: {
23242331 if (in.token == COMMA ) {
Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ ImportExpr ::= StableId ‘.’ (id | ‘_’ | ImportSelectors)
338338ImportSelectors ::= ‘{’ {ImportSelector ‘,’} FinalSelector ‘}’
339339FinalSelector ::= ImportSelector Ident(name)
340340 | ‘_’ Pair(id, id)
341- | ‘for’ InfixType TypeBoundsTree(EmptyTree, tpt)
341+ | ‘for’ InfixType {‘,’ InfixType} TypeBoundsTree(EmptyTree, tpt)
342342ImportSelector ::= id [‘=>’ id | ‘=>’ ‘_’]
343343Export ::= ‘export’ [‘implied’] ImportExpr {‘,’ ImportExpr}
344344```
Original file line number Diff line number Diff line change @@ -4,18 +4,22 @@ object A {
44
55 class B extends T
66 class C extends T
7+ class D
78
89 implied b for B
910 implied c for C
10- implied d for T
11+ implied t for T
12+ implied d for D
1113}
1214
1315object Test extends App {
1416 import A ._
15- import implied A .{d , for B }
17+ import implied A .{t , for B , D }
1618
17- println(d)
18- val x : B = b
19+ val x1 : B = b
20+ val x2 : T = t
21+ val x3 : D = d
1922
2023 assert(the[T ].isInstanceOf [B ])
24+ assert(the[D ].isInstanceOf [D ])
2125}
You can’t perform that action at this time.
0 commit comments