Skip to content

Commit 49337a0

Browse files
committed
Remove {neg-custom-args,pos-special}/isInstanceOf
1 parent 0f5b996 commit 49337a0

34 files changed

+65
-52
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,14 @@ class CompilationTests {
3737
compileFilesInDir("tests/pos-special/fatal-warnings", defaultOptions.and("-Xfatal-warnings", "-deprecation", "-feature")),
3838
compileFilesInDir("tests/pos-special/spec-t5545", defaultOptions),
3939
compileFilesInDir("tests/pos-special/strawman-collections", allowDeepSubtypes),
40-
compileFilesInDir("tests/pos-special/isInstanceOf", allowDeepSubtypes.and("-Xfatal-warnings")),
4140
compileFilesInDir("tests/new", defaultOptions.and("-source", "3.2")), // just to see whether 3.2 works
4241
compileFilesInDir("tests/pos-scala2", scala2CompatMode),
4342
compileFilesInDir("tests/pos-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")),
4443
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")),
4544
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),
4645
compileFilesInDir("tests/pos-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")),
4746
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
48-
compileFile(
49-
// succeeds despite -Xfatal-warnings because of -nowarn
50-
"tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala",
51-
defaultOptions.and("-nowarn", "-Xfatal-warnings")
52-
),
47+
compileFile("tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala", defaultOptions.and("-nowarn", "-Xfatal-warnings")), // succeeds despite -Xfatal-warnings because of -nowarn
5348
compileFile("tests/pos-special/typeclass-scaling.scala", defaultOptions.and("-Xmax-inlines", "40")),
5449
compileFile("tests/pos-special/i7296.scala", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
5550
compileDir("tests/pos-special/adhoc-extension", defaultOptions.and("-source", "future", "-feature", "-Xfatal-warnings")),
@@ -162,7 +157,6 @@ class CompilationTests {
162157
compileFile("tests/neg-custom-args/i15575.scala", defaultOptions.and("-explain")),
163158
compileFile("tests/neg-custom-args/interop-polytypes.scala", allowDeepSubtypes.and("-Yexplicit-nulls")),
164159
compileFile("tests/neg-custom-args/conditionalWarnings.scala", allowDeepSubtypes.and("-deprecation").and("-Xfatal-warnings")),
165-
compileFilesInDir("tests/neg-custom-args/isInstanceOf", allowDeepSubtypes and "-Xfatal-warnings"),
166160
compileFile("tests/neg-custom-args/i3627.scala", allowDeepSubtypes),
167161
compileFile("tests/neg-custom-args/sourcepath/outer/nested/Test1.scala", defaultOptions.and("-sourcepath", "tests/neg-custom-args/sourcepath")),
168162
compileDir("tests/neg-custom-args/sourcepath2/hi", defaultOptions.and("-sourcepath", "tests/neg-custom-args/sourcepath2", "-Xfatal-warnings")),

tests/neg-custom-args/isInstanceOf/i5495.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/neg-custom-args/isInstanceOf/1828.scala renamed to tests/neg/1828.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class Test {
23
def remove[S](a: S | Int, f: Int => S):S = a match {
34
case a: S => a // error

tests/neg-custom-args/isInstanceOf/3324b.scala renamed to tests/neg/3324b.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class C[T] {
23
val x: Any = ???
34
if (x.isInstanceOf[List[String]]) // error: unchecked
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
trait C[T]
23
class D[T]
34

@@ -6,4 +7,4 @@ class Test {
67
case _: D[T] => // error
78
case _: C[Int] => // error
89
}
9-
}
10+
}

tests/neg-custom-args/isInstanceOf/3324g.scala renamed to tests/neg/3324g.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class Test {
23
trait A[+T]
34
class B[T] extends A[T]

tests/neg-custom-args/isInstanceOf/4075.scala.ignore renamed to tests/neg/4075.scala.ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
object Test {
23
trait Foo
34
case class One[+T](fst: T)

tests/neg-custom-args/isInstanceOf/JavaSeqLiteral.scala renamed to tests/neg/JavaSeqLiteral.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
object Test1 {
23
trait Tree[-T]
34

@@ -26,4 +27,4 @@ object Test2 {
2627
tree.isInstanceOf[JavaSeqLiteral[Type]]
2728

2829
foo1(new DummyTree)
29-
}
30+
}

tests/neg-custom-args/isInstanceOf/enum-approx2.scala renamed to tests/neg/enum-approx2.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
sealed trait Exp[T]
23
case class Fun[A, B](f: Exp[A => B]) extends Exp[A => B]
34

@@ -7,4 +8,4 @@ class Test {
78
case Fun(x: Exp[Int => String]) => ??? // error
89
case _ =>
910
}
10-
}
11+
}

tests/neg-custom-args/isInstanceOf/gadt.scala renamed to tests/neg/gadt.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class Test {
23
trait A[+T]
34
class B[T] extends A[T]
@@ -10,4 +11,4 @@ class Test {
1011
}
1112

1213
quux(new B[D])
13-
}
14+
}

tests/neg-custom-args/isInstanceOf/html.scala renamed to tests/neg/html.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
object HTML:
23
type AttrArg = AppliedAttr | Seq[AppliedAttr]
34
opaque type AppliedAttr = String

tests/neg-custom-args/isInstanceOf/i11178.scala renamed to tests/neg/i11178.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
trait Box[+T]
23
case class Foo[+S](s: S) extends Box[S]
34

@@ -36,4 +37,4 @@ object Test3 {
3637
case _: Bar[Boolean] => ??? // error
3738
case _ => ???
3839
}
39-
}
40+
}

tests/neg-custom-args/isInstanceOf/i3324.scala renamed to tests/neg/i3324.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class Foo {
23
def foo(x: Any): Boolean =
34
x.isInstanceOf[List[String]] // error

tests/neg-custom-args/isInstanceOf/i4297.scala renamed to tests/neg/i4297.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class Test {
23
def test[X <: Option[Int]](x: X) = x.isInstanceOf[Some[Int]]
34
def test1[Y <: Int, X <: Option[Y]](x: X) = x.isInstanceOf[Some[Int]]

tests/neg/i5495.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1+
// scalac: -Werror
2+
13
lazy enum LazyList[+A] { // error: sealed abstract types cannot be lazy enum
24
case ::[A] (head: A, tail: LazyList[A]) extends LazyList[A]
35
case Nil
46
}
7+
8+
class A
9+
class B
10+
11+
type AorB = A | B
12+
13+
def foo(any: Any) = any match {
14+
case aorb: AorB =>
15+
case _ =>
16+
}
17+
18+
def bar[T](x: List[T]) = x.isInstanceof[List[Int]] // error

tests/neg-custom-args/isInstanceOf/i5826.scala renamed to tests/neg/i5826.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class Foo {
23
def test[A]: List[Int] | A => Int = {
34
case ls: List[Int] => ls.head // error

tests/neg-custom-args/isInstanceOf/i5826b.scala renamed to tests/neg/i5826b.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class Foo {
23
def test1[A]: List[Int] | A => Int = {
34
case ls: List[_] => ls.head // error

tests/neg-custom-args/isInstanceOf/i8932.scala renamed to tests/neg/i8932.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
sealed trait Foo[+A]
23
case class Bar[A]() extends Foo[A]
34

@@ -9,4 +10,4 @@ def bugReport[A](foo: Foo[A]): Foo[A] =
910
case dummy: Dummy => ???
1011
}
1112

12-
def test = bugReport(new Dummy: Foo[String])
13+
def test = bugReport(new Dummy: Foo[String])

tests/neg-custom-args/isInstanceOf/or-type-trees.scala renamed to tests/neg/or-type-trees.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
object Test1 {
23
trait Tree
34
trait Context
@@ -35,4 +36,4 @@ object Test2 {
3536
myTree match
3637
case treeFn: (_ => _) => // ok
3738
case _ =>
38-
}
39+
}

tests/neg-custom-args/isInstanceOf/patmat-applied.scala renamed to tests/neg/patmat-applied.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class A[-T]
23
class B[T] extends A[T]
34

tests/neg-custom-args/isInstanceOf/refined-types.scala renamed to tests/neg/refined-types.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class A
23
class B extends A
34
type AA = A { type T = Int }

tests/neg-custom-args/isInstanceOf/t2755.scala renamed to tests/neg/t2755.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
// Test cases: the only place we can cut and paste without crying
23
// ourself to sleep.
34
object Test {

tests/neg-custom-args/isInstanceOf/type-lambda.scala renamed to tests/neg/type-lambda.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
trait A[T]
23
trait B[T] extends A[T]
34

tests/pos-special/isInstanceOf/Result.scala

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/pos-special/isInstanceOf/i9782.scala

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/pos-special/isInstanceOf/3324c.scala renamed to tests/pos/3324c.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
sealed trait A[T]
23
class B[T] extends A[T]
34

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// scalac: -Werror
12
class Test {
23
val x: Any = ???
34

45
x match {
56
case _: List[Int @unchecked] => 5
67
case _: Option[Int] @unchecked => 5
78
}
8-
}
9+
}

tests/pos-special/isInstanceOf/3324e.scala renamed to tests/pos/3324e.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
class C[T] {
23
val x: T = ???
34
x.isInstanceOf[T]

tests/pos-special/isInstanceOf/3324h.scala renamed to tests/pos/3324h.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
object Test {
23
trait Marker
34
def foo[T](x: T) = x match {

tests/pos/Result.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
// scalac: -Werror
12
import scala.util.control.NonFatal
23
object p {
34

5+
// test parametric case classes, which synthesis `canEqual` and `equals`
46
enum Result[+T, +E] {
57
case OK [T](x: T) extends Result[T, Nothing]
68
case Err[E](e: E) extends Result[Nothing, E]

tests/pos-special/isInstanceOf/classTag.scala renamed to tests/pos/classTag.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
import scala.reflect.ClassTag
23

34
object IsInstanceOfClassTag {
@@ -7,4 +8,4 @@ object IsInstanceOfClassTag {
78
case _ => None
89
}
910
}
10-
}
11+
}

tests/pos-special/isInstanceOf/gadt.scala renamed to tests/pos/gadt.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
sealed trait Exp[T]
23
case class Num(n: Int) extends Exp[Int]
34
case class Plus(e1: Exp[Int], e2: Exp[Int]) extends Exp[Int]
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
// scalac: -Werror
12
class Test {
23
type MyCombo = Int | Unit
34
val z: MyCombo = 10
45
z match
56
case i: Int => ???
67
case _ => ???
7-
}
8+
}

tests/pos/i9782.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Werror
12
trait Txn[T <: Txn[T]]
23

34
trait Elem[T <: Txn[T]]
@@ -17,3 +18,13 @@ trait Copy[In <: Txn[In], Out <: Txn[Out]] {
1718
out
1819
}
1920
}
21+
22+
class Test {
23+
24+
def apply[Repr[~ <: Txn[~]] <: Elem[~], In <: Txn[In]](in: Repr[In]): Unit = {
25+
in match {
26+
case inObj: Obj[In] => // problem here
27+
case _ =>
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)