Skip to content

Commit ec45b09

Browse files
committed
Fix tests
- some tests do deeper subtype recursions, need to be run without -Yno-deep-subtypes - some tests have different outcomes, but the new outcome looks sensible. - some new tests
1 parent 1c399d2 commit ec45b09

File tree

8 files changed

+33
-7
lines changed

8 files changed

+33
-7
lines changed

compiler/test/dotc/tests.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ class tests extends CompilerTest {
104104
val typerDir = dotcDir + "typer/"
105105
val libDir = "../library/src/"
106106

107-
def dottyBootedLib = compileDir(libDir, ".", List("-deep", "-Ycheck-reentrant", "-strict") ::: defaultOptions)(allowDeepSubtypes) // note the -deep argument
108-
def dottyDependsOnBootedLib = compileDir(dottyDir, ".", List("-deep", "-Ycheck-reentrant") ::: defaultOptions)(allowDeepSubtypes) // note the -deep argument
107+
def dottyBootedLib = compileDir(libDir, ".", List("-deep", "-Ycheck-reentrant", "-strict"))(allowDeepSubtypes) // note the -deep argument
108+
def dottyDependsOnBootedLib = compileDir(dottyDir, ".", List("-deep", "-Ycheck-reentrant"))(allowDeepSubtypes) // note the -deep argument
109109

110110
@Before def cleanup(): Unit = {
111111
// remove class files from stdlib and tests compilation
@@ -194,7 +194,6 @@ class tests extends CompilerTest {
194194
@Test def neg_i1240 = compileFile(negCustomArgs, "i1240")(allowDoubleBindings)
195195
@Test def neg_i2002 = compileFile(negCustomArgs, "i2002")(allowDoubleBindings)
196196
@Test def neg_valueclasses_doubledefs = compileFile(negCustomArgs, "valueclasses-doubledefs")(allowDoubleBindings)
197-
@Test def neg_valueclasses_doubledefs2 = compileFile(negCustomArgs, "valueclasses-doubledefs2")(allowDoubleBindings)
198197
@Test def neg_valueclasses_pavlov = compileFile(negCustomArgs, "valueclasses-pavlov")(allowDoubleBindings)
199198
@Test def neg_trailingUnderscore = compileFile(negCustomArgs, "trailingUnderscore", args = "-strict" :: Nil)
200199

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ class CompilationTests extends ParallelTesting {
2727

2828
// Positive tests ------------------------------------------------------------
2929

30+
// @Test // enable to test compileStdLib separately with detailed stats
31+
def compileStdLib: Unit = {
32+
compileList("compileStdLib", StdLibSources.whitelisted, scala2Mode.and("-migration", "-Yno-inline", "-Ydetailed-stats"))
33+
}.checkCompile()
34+
3035
@Test def compilePos: Unit = {
3136
compileList("compileStdLib", StdLibSources.whitelisted, scala2Mode.and("-migration", "-Yno-inline")) +
3237
compileDir("../collection-strawman/src/main", defaultOptions) +
@@ -85,6 +90,7 @@ class CompilationTests extends ParallelTesting {
8590
compileFilesInDir("../tests/new", defaultOptions) +
8691
compileFilesInDir("../tests/pos-scala2", scala2Mode) +
8792
compileFilesInDir("../tests/pos", defaultOptions) +
93+
compileFilesInDir("../tests/pos-deep-subtype", allowDeepSubtypes) +
8894
compileFile(
8995
// succeeds despite -Xfatal-warnings because of -nowarn
9096
"../tests/neg/customArgs/xfatalWarnings.scala",

compiler/test/dotty/tools/vulpix/TestConfiguration.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ object TestConfiguration {
6262
"-Ytest-pickler",
6363
"-Yprintpos"
6464
)
65+
val picklingOptionsAllowDeepSubTypes = picklingOptions diff Array("-Yno-deep-subtypes")
6566
val scala2Mode = defaultOptions ++ Array("-language:Scala2")
6667
val explicitUTF8 = defaultOptions ++ Array("-encoding", "UTF8")
6768
val explicitUTF16 = defaultOptions ++ Array("-encoding", "UTF16")

tests/neg/leak-type.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
trait A {
2-
private type Foo = Int
2+
private class Foo
33

44

5-
class Inner[T <: Foo] { // error: non-private type T refers to private type Foo in its type signature
5+
class Inner[T <: Foo] { // error: non-private type T refers to private class Foo in its type signature
66
def get: T = ???
77
}
88
}
99
class B extends A {
1010
def foo(x: Inner[_]): Unit = {
11-
val a = x.get // error: cannot resolve reference to type B(B.this).Foo
11+
val a = x.get
1212
}
1313
}

tests/neg/customArgs/valueclasses-doubledefs2.scala renamed to tests/neg/valueclasses-doubledefs2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ trait B {
77
def apply(x: Meter) = x.toString
88
}
99

10-
object Test extends A with B // error: double def
10+
object Test extends A with B // error: double definition
File renamed without changes.

tests/pos/i2974.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
trait Foo[-T]
2+
3+
trait Bar[-T] extends Foo[T]
4+
5+
object Test {
6+
implicit val fa: Foo[Any] = ???
7+
implicit val ba: Bar[Int] = ???
8+
9+
def test: Unit = {
10+
implicitly[Foo[Int]]
11+
}
12+
}

tests/pos/i2982.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
object A {
2+
def fun[E >: B](a: A[E]): E => Unit = ???
3+
val x = fun(new A[C])
4+
}
5+
class B extends C
6+
class C
7+
8+
class A[-X >: B]

0 commit comments

Comments
 (0)