mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[java-highlighting] IDEA-324708 Coverage with 2 sealed hierarchies
GitOrigin-RevId: c38172bc2a5f16c29a7587f798d889da1c9d80eb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
20285c8d02
commit
9add8b349e
@@ -656,7 +656,7 @@ public class SwitchBlockHighlightingModel {
|
||||
holder.add(info.create());
|
||||
return;
|
||||
}
|
||||
if (!TypeConversionUtil.areTypesConvertible(mySelectorType, patternType) ||
|
||||
if (!ContainerUtil.and(getAllTypes(mySelectorType), type -> TypeConversionUtil.areTypesConvertible(type, patternType)) ||
|
||||
// 14.30.3 A type pattern that declares a pattern variable of a reference type U is
|
||||
// applicable at another reference type T if T is checkcast convertible to U (JEP 440-441)
|
||||
// There is no rule that says that a reference type applies to a primitive type
|
||||
|
||||
@@ -93,4 +93,19 @@ class X {
|
||||
}
|
||||
|
||||
native static boolean predicate();
|
||||
|
||||
sealed interface I1 {}
|
||||
sealed interface I2 {}
|
||||
record R1() implements I1 {}
|
||||
record R2() implements I2 {}
|
||||
record R3() implements I1, I2 {};
|
||||
|
||||
public class Test22{
|
||||
public <T extends I1 & I2> void test(T c) {
|
||||
switch (c) {
|
||||
case <error descr="Incompatible types. Found: 'X.R2', required: 'T'">R2 r1</error> -> System.out.println(5);
|
||||
case R3 r1 -> System.out.println(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user