Skip to content

Commit

Permalink
adjust tests on JDK 17+ for PermittedSubclasses change
Browse files Browse the repository at this point in the history
references scala#10105
  • Loading branch information
SethTisue committed Apr 27, 2023
1 parent d193135 commit 727be50
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 2 deletions.
11 changes: 11 additions & 0 deletions test/files/neg/t8700b-new.check
@@ -0,0 +1,11 @@
Bar_2.scala:4: warning: match may not be exhaustive.
It would fail on the following input: B
def bar1(foo: Foo_1) = foo match {
^
Bar_2.scala:8: warning: match may not be exhaustive.
It would fail on the following inputs: (_ : Baz_1$1), (_ : Baz_1$2), B
def bar2(foo: Baz_1) = foo match {
^
error: No warnings can be incurred under -Werror.
2 warnings
1 error
11 changes: 11 additions & 0 deletions test/files/neg/t8700b-new/Bar_2.scala
@@ -0,0 +1,11 @@
// javaVersion: 17+
// scalac: -Werror
object Bar {
def bar1(foo: Foo_1) = foo match {
case Foo_1.A => 1
}

def bar2(foo: Baz_1) = foo match {
case Baz_1.A => 1
}
}
12 changes: 12 additions & 0 deletions test/files/neg/t8700b-new/Baz_1.java
@@ -0,0 +1,12 @@
// javaVersion: 17+
public enum Baz_1 {
A {
public void baz1() {}
},
B {
public void baz1() {}
};

public abstract void baz1();
public void baz2() {}
}
5 changes: 5 additions & 0 deletions test/files/neg/t8700b-new/Foo_1.java
@@ -0,0 +1,5 @@
// javaVersion: 17+
public enum Foo_1 {
A,
B
}
@@ -1,8 +1,8 @@
Bar_2.scala:3: warning: match may not be exhaustive.
Bar_2.scala:4: warning: match may not be exhaustive.
It would fail on the following input: B
def bar1(foo: Foo_1) = foo match {
^
Bar_2.scala:7: warning: match may not be exhaustive.
Bar_2.scala:8: warning: match may not be exhaustive.
It would fail on the following input: B
def bar2(foo: Baz_1) = foo match {
^
Expand Down
@@ -1,3 +1,4 @@
// javaVersion: 8
// scalac: -Werror
object Bar {
def bar1(foo: Foo_1) = foo match {
Expand Down
@@ -1,3 +1,4 @@
// javaVersion: 8
public enum Baz_1 {
A {
public void baz1() {}
Expand Down
@@ -1,3 +1,4 @@
// javaVersion: 8
public enum Foo_1 {
A,
B
Expand Down

0 comments on commit 727be50

Please sign in to comment.