File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ class Foo [A ]
2
+ class Bar [B ]
3
+ class Baz [C ] extends Bar [C ]
4
+
5
+ object Test1 {
6
+ type Alias [F [X ] <: Foo [X ]] = F [Int ]
7
+
8
+ val x : Alias [Bar ] = new Bar [Int ] // error: Type argument [X0] -> Bar[X0] does not conform to upper bound [X0] -> Foo[X0]
9
+
10
+ def foo [F [X ] <: Foo [X ]] = ()
11
+ foo[Bar ] // error: Type argument [X0] -> Bar[X0] does not conform to upper bound [X0] -> Foo[X0]
12
+
13
+ def bar [B [X ] >: Bar [X ]] = ()
14
+ bar[Bar ] // ok
15
+ bar[Baz ] // // error: Type argument [X0] -> Baz[X0] does not conform to lower bound [X0] -> Bar[X0]
16
+ bar[Foo ] // error: Type argument [X0] -> Foo[X0] does not conform to lower bound [X0] -> Bar[X0]
17
+
18
+ def baz [B [X ] >: Baz [X ]] = ()
19
+ baz[Bar ] // ok
20
+ baz[Baz ] // ok
21
+ baz[Foo ] // error: Type argument [X0] -> Foo[X0] does not conform to lower bound [X0] -> Baz[X0]
22
+
23
+ }
You can’t perform that action at this time.
0 commit comments