1 /*
   2  * @test /nodynamiccopyright/
   3  * @summary Ensure that in type test patterns, the predicate is not trivially provable false.
   4  * @compile/fail/ref=PatternVariablesAreFinal.out -XDrawDiagnostics PatternVariablesAreFinal.java
   5  */
   6 public class PatternVariablesAreFinal {
   7     public static void main(String[] args) {
   8         Object o = 32;
   9         if (o instanceof String s) {
  10             s = "hello again";
  11             System.out.println(s);
  12         }
  13         System.out.println("test complete");
  14     }
  15 }