Skip to content

Commit

Permalink
Regression test for snippet from #1804 that works fine now (#2014)
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanth-sankaran committed Feb 14, 2024
1 parent 208f95f commit 663ddf1
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4096,4 +4096,37 @@ public static void main(String[] args) {
+ "110\n"
+ "220");
}
// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1804
// Revisit code generation for record patterns
public void testIssue1804() {
runConformTest(
new String[] {
"X.java",
"""
public class X {
record Paper(int color) {}
record Box<T>(T a) {}
public static void main(String argv[]) {
foo(null, null);
}
public static void foo(String abc, String def) {
Box<?> p = new Box<>(new Paper(0));
boolean b = false;
switch (p) {
case Box(Paper a) -> {
b = true;
break;
}
default -> {
b = false;
break;
}
}
System.out.println(b);
}
}
"""
},
"true");
}
}

0 comments on commit 663ddf1

Please sign in to comment.