Skip to content

Another regression test for bad bounds #5867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class CompilationTests extends ParallelTesting {
compileFile("tests/neg-custom-args/overrideClass.scala", scala2Mode) +
compileFile("tests/neg-custom-args/autoTuplingTest.scala", defaultOptions.and("-language:noAutoTupling")) +
compileFile("tests/neg-custom-args/i1050.scala", defaultOptions.and("-strict")) +
compileFile("tests/neg-custom-args/nullless.scala", defaultOptions.and("-strict")) +
compileFile("tests/neg-custom-args/nopredef.scala", defaultOptions.and("-Yno-predef")) +
compileFile("tests/neg-custom-args/noimports.scala", defaultOptions.and("-Yno-imports")) +
compileFile("tests/neg-custom-args/noimports2.scala", defaultOptions.and("-Yno-imports")) +
Expand Down
40 changes: 40 additions & 0 deletions tests/neg-custom-args/nullless.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
object nullless {
trait LowerBound[T] {
type M >: T;
}
trait UpperBound[U] {
type M <: U;
}
lazy val nothing : Nothing = nothing
class Box[V](val v: V)
lazy val box : Box[UpperBound[String] & LowerBound[Int]] = new Box(nothing)
def upcast(t : box.v.M) : box.v.M = t // error // error under -strict
def main(args : Array[String]) : Unit = {
val zero : String = upcast(0)
println("...")
}
}
object bar {
trait Sub {
type M
type L <: M
type U >: M
type M2 >: L <: U
}
class Box[V](val v: V)

class Caster[LL, UU] {
trait S2 {
type L = LL
type U = UU
}
final lazy val nothing: Nothing = nothing
final lazy val sub: S2 with Sub = nothing
final lazy val box : Box[S2 with Sub] = new Box(nothing)
def upcast(t: box.v.M2): box.v.M2 = t // error // error under -strict
}
def main(args : Array[String]) : Unit = {
val zero : String = (new Caster[Int,String]()).upcast(0)
println("...")
}
}