File tree 3 files changed +41
-6
lines changed
compiler/src/dotty/tools/dotc/typer 3 files changed +41
-6
lines changed Original file line number Diff line number Diff line change @@ -459,10 +459,7 @@ trait ImplicitRunInfo { self: Run =>
459
459
}
460
460
tp.classSymbols(liftingCtx) foreach addClassScope
461
461
case _ =>
462
- // We exclude lower bounds to conform to SLS 7.2:
463
- // "The parts of a type T are: [...] if T is an abstract type, the parts of its upper bound"
464
- for (part <- tp.namedPartsWith(_.isType, excludeLowerBounds = true ))
465
- comps ++= iscopeRefs(part)
462
+ for (part <- tp.namedPartsWith(_.isType)) comps ++= iscopeRefs(part)
466
463
}
467
464
comps
468
465
}
Original file line number Diff line number Diff line change
1
+ package commandeer
2
+
3
+
4
+ trait CommandeerDSL [Host ] {
5
+ trait Operation [T ]
6
+ type Op [T ] <: Operation [T ]
7
+ }
8
+
9
+ object CommandeerDSL {
10
+ def apply [Host , DSL <: CommandeerDSL [Host ]](host : Host )(implicit dsl : DSL ): DSL = dsl
11
+ }
12
+
13
+ trait Foo {
14
+ def bar (a : String , b : Int ): Double
15
+ }
16
+
17
+ object Foo {
18
+ implicit val fooDSL : FooDSL = new FooDSL {}
19
+ }
20
+
21
+ trait FooDSL extends CommandeerDSL [Foo ] {
22
+ sealed trait FooOperation [T ] extends Operation [T ]
23
+ type Op [T ] = FooOperation [T ]
24
+
25
+ case class Bar (a : String , b : Int ) extends FooOperation [Double ]
26
+ }
27
+
28
+ object RunMe {
29
+ // import Foo._
30
+ def main (args : Array [String ]): Unit = {
31
+ println(" Hi Mum" )
32
+
33
+ val kevin = CommandeerDSL (null .asInstanceOf [Foo ])
34
+ println(s " Found DSL for Foo: $kevin" )
35
+ val bar = kevin.Bar (" bob" , 3 )
36
+ println(s " Made a bar: $bar" )
37
+ }
38
+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ class Test {
9
9
def get1 (implicit lf : List [_ <: Bar ]) = {}
10
10
def get2 (implicit lf : List [_ >: Bar ]) = {}
11
11
12
- get1 // works
13
- get2 // error
12
+ get1
13
+ get2
14
14
}
You can’t perform that action at this time.
0 commit comments