mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
IDEA-300124: highlight raw deconstruction patterns
GitOrigin-RevId: 8c5c34e21d9952a67b880868fe3ac600f058c582
This commit is contained in:
committed by
intellij-monorepo-bot
parent
550471e65e
commit
db97df0ad1
@@ -1,6 +1,7 @@
|
||||
record Top(Child c1, Child c2) {}
|
||||
record Child(I x, I y){}
|
||||
record Wrong(int x) {}
|
||||
record TypedRecord<T>(T t) {}
|
||||
|
||||
sealed interface I permits A, B {}
|
||||
final class A implements I {}
|
||||
@@ -18,6 +19,13 @@ public class Test {
|
||||
}
|
||||
}
|
||||
|
||||
<T> void testRawDeconstruction(TypedRecord<T> r) {
|
||||
if (r instanceof TypedRecord<T>(I t)){ }
|
||||
if (r instanceof TypedRecord<T>(T t)){ }
|
||||
if (r instanceof <error descr="Raw deconstruction patterns are not allowed">TypedRecord</error>(I t)){ }
|
||||
if (r instanceof <error descr="Raw deconstruction patterns are not allowed">TypedRecord</error>(T t)){ }
|
||||
}
|
||||
|
||||
void resolveHighlighting1(Object o){
|
||||
if (o instanceof Child(A a, B b) c){
|
||||
System.out.println(a);
|
||||
|
||||
@@ -40,6 +40,11 @@ public class Incompatible {
|
||||
case TypedRecord<I>(I x) s-> {}
|
||||
default -> {}
|
||||
}
|
||||
switch (typedRecord){
|
||||
case <error descr="Raw deconstruction patterns are not allowed">TypedRecord</error>(C x) s-> {}
|
||||
case <error descr="Raw deconstruction patterns are not allowed">TypedRecord</error>(I x) s-> {}
|
||||
default -> {}
|
||||
}
|
||||
switch (object){
|
||||
case Top(Child c1, Child(I x, <error descr="Incompatible types. Found: 'int', required: 'I'">int y</error>) c3) c -> { }
|
||||
case Top(Child c1, <error descr="Incompatible types. Found: 'Wrong', required: 'Child'">Wrong(int y) c3</error>) c -> { }
|
||||
|
||||
Reference in New Issue
Block a user