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 {
2310
2310
/** ImportSelectors ::= `{' {ImportSelector `,'} FinalSelector ‘}’
2311
2311
* FinalSelector ::= ImportSelector
2312
2312
* | ‘_’
2313
- * | ‘for’ InfixType
2313
+ * | ‘for’ InfixType {‘,’ InfixType}
2314
2314
*/
2315
2315
def importSelectors (): List [Tree ] = in.token match {
2316
2316
case USCORE =>
2317
2317
wildcardIdent() :: Nil
2318
2318
case FOR =>
2319
2319
if (! importImplied)
2320
2320
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
2322
2329
case _ =>
2323
2330
importSelector() :: {
2324
2331
if (in.token == COMMA ) {
Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ ImportExpr ::= StableId ‘.’ (id | ‘_’ | ImportSelectors)
338
338
ImportSelectors ::= ‘{’ {ImportSelector ‘,’} FinalSelector ‘}’
339
339
FinalSelector ::= ImportSelector Ident(name)
340
340
| ‘_’ Pair(id, id)
341
- | ‘for’ InfixType TypeBoundsTree(EmptyTree, tpt)
341
+ | ‘for’ InfixType {‘,’ InfixType} TypeBoundsTree(EmptyTree, tpt)
342
342
ImportSelector ::= id [‘=>’ id | ‘=>’ ‘_’]
343
343
Export ::= ‘export’ [‘implied’] ImportExpr {‘,’ ImportExpr}
344
344
```
Original file line number Diff line number Diff line change @@ -4,18 +4,22 @@ object A {
4
4
5
5
class B extends T
6
6
class C extends T
7
+ class D
7
8
8
9
implied b for B
9
10
implied c for C
10
- implied d for T
11
+ implied t for T
12
+ implied d for D
11
13
}
12
14
13
15
object Test extends App {
14
16
import A ._
15
- import implied A .{d , for B }
17
+ import implied A .{t , for B , D }
16
18
17
- println(d)
18
- val x : B = b
19
+ val x1 : B = b
20
+ val x2 : T = t
21
+ val x3 : D = d
19
22
20
23
assert(the[T ].isInstanceOf [B ])
24
+ assert(the[D ].isInstanceOf [D ])
21
25
}
You can’t perform that action at this time.
0 commit comments