File tree 2 files changed +41
-0
lines changed
compiler/test/dotty/tools/dotc
2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ class CompilationTests extends ParallelTesting {
155
155
compileFile(" tests/neg-custom-args/overrideClass.scala" , scala2Mode) +
156
156
compileFile(" tests/neg-custom-args/autoTuplingTest.scala" , defaultOptions.and(" -language:noAutoTupling" )) +
157
157
compileFile(" tests/neg-custom-args/i1050.scala" , defaultOptions.and(" -strict" )) +
158
+ compileFile(" tests/neg-custom-args/nullless.scala" , defaultOptions.and(" -strict" )) +
158
159
compileFile(" tests/neg-custom-args/nopredef.scala" , defaultOptions.and(" -Yno-predef" )) +
159
160
compileFile(" tests/neg-custom-args/noimports.scala" , defaultOptions.and(" -Yno-imports" )) +
160
161
compileFile(" tests/neg-custom-args/noimports2.scala" , defaultOptions.and(" -Yno-imports" )) +
Original file line number Diff line number Diff line change
1
+ object nullless {
2
+ trait LowerBound [T ] {
3
+ type M >: T ;
4
+ }
5
+ trait UpperBound [U ] {
6
+ type M <: U ;
7
+ }
8
+ lazy val nothing : Nothing = nothing
9
+ class Box [V ](val v : V )
10
+ lazy val box : Box [UpperBound [String ] & LowerBound [Int ]] = new Box (nothing)
11
+ def upcast (t : box.v.M ) : box.v.M = t // error // error under -strict
12
+ def main (args : Array [String ]) : Unit = {
13
+ val zero : String = upcast(0 )
14
+ println(" ..." )
15
+ }
16
+ }
17
+ object bar {
18
+ trait Sub {
19
+ type M
20
+ type L <: M
21
+ type U >: M
22
+ type M2 >: L <: U
23
+ }
24
+ class Box [V ](val v : V )
25
+
26
+ class Caster [LL , UU ] {
27
+ trait S2 {
28
+ type L = LL
29
+ type U = UU
30
+ }
31
+ final lazy val nothing : Nothing = nothing
32
+ final lazy val sub : S2 with Sub = nothing
33
+ final lazy val box : Box [S2 with Sub ] = new Box (nothing)
34
+ def upcast (t : box.v.M2 ): box.v.M2 = t // error // error under -strict
35
+ }
36
+ def main (args : Array [String ]) : Unit = {
37
+ val zero : String = (new Caster [Int ,String ]()).upcast(0 )
38
+ println(" ..." )
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments