Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingPatterns/InstanceOfPatternMatching.java
Ilyas Selimov fee12f1d34 java - moved some tests as they belong rather to highlighting than to DFA
GitOrigin-RevId: af470efb050d162026ef7a492d60f912fca655e2
2021-11-08 10:22:21 +00:00

36 lines
1.1 KiB
Java

class Main {
private static final boolean TRUE = 1 == 1;
void testParenthesizedPattern(String s) {
if (s instanceof (<error descr="Pattern type 'String' is the same as expression type">String</error> s1)) {
System.out.println(s1);
}
}
void testDeepParenthesizedPattern(String s) {
if (s instanceof ( ((( (( <error descr="Pattern type 'String' is the same as expression type">String</error> s1)) )) ) )) {
System.out.println(s1);
}
}
void testGuardedPatternWithCompileTimeCondition1(String s) {
if (s instanceof (<error descr="Pattern type 'String' is the same as expression type">String</error> s1 && true)) {
System.out.println(s1);
}
}
void testGuardedPatternWithAlwaysTrueCondition2(String s) {
if (s instanceof (<error descr="Pattern type 'String' is the same as expression type">String</error> s1 && TRUE)) {
System.out.println(s1);
}
}
void testGuardedPatternWithAlwaysTrueCondition3(String s) {
if (s instanceof ((<error descr="Pattern type 'String' is the same as expression type">String</error> s1 && true) && true)) {
System.out.println(s1);
}
}
}