1 /*
   2  * @test /nodynamiccopyright/
   3  * @summary Clashing bindings are reported correctly
   4  * @compile/fail/ref=BindingsExistTest.out -XDrawDiagnostics BindingsExistTest.java
   5  */
   6 public class BindingsExistTest {
   7     public void t(Object o1, Object o2) {
   8         if (o1 instanceof String k && o2 instanceof Integer k) {}
   9 
  10         if (o1 instanceof String k || o2 instanceof Integer k) {}
  11 
  12         if (!(o1 instanceof String k)) {
  13             return ;
  14         }
  15         if (o1 instanceof Integer k) {}
  16 
  17         String s2 = "";
  18         if (o1 instanceof String s2) {}
  19 
  20         if (o1 instanceof String s3) {
  21             String s3 = "";
  22         }
  23 
  24         if (!(o1 instanceof String s4)) {
  25             return ;
  26         }
  27         String s4 = "";
  28     }
  29 }