void () { myFixture.configureByText("Test.java", """ import java.util.function.Supplier; record Box<T>(T get) implements Supplier<T> {} class Test { void test(Supplier<CharSequence> cs) { if (cs instanceof Box(String s)) {s.trim();} if (cs instanceof Box(Number s)) {s.intValue();} if (cs instanceof Box(<error descr="Incompatible types. Found: 'java.lang.Integer', required: 'java.lang.CharSequence'">Integer s</error>)) {s.intValue();} } } """); myFixture.checkHighlighting(); }