mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inference: mark call unchecked required when proper types are compared (IDEA-164243)
This commit is contained in:
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,6 +51,9 @@ public class ExpressionCompatibilityConstraint extends InputOutputConstraintForm
|
||||
final PsiType type = myExpression.getType();
|
||||
session.registerIncompatibleErrorMessage((type != null ? type.getPresentableText() : myExpression.getText()) + " is not compatible with " + session.getPresentableText(myT));
|
||||
}
|
||||
else if (TypeCompatibilityConstraint.isUncheckedConversion(myT, exprType)) {
|
||||
session.setErasedDuringApplicabilityCheck();
|
||||
}
|
||||
return assignmentCompatible;
|
||||
}
|
||||
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
class Test {
|
||||
private static AG<AE> foo(Class clz) {
|
||||
return (AG<AE>) foo1(clz);
|
||||
}
|
||||
|
||||
private static <T extends E> G<T> foo1(Class<? extends E> clz) {
|
||||
return null;
|
||||
}
|
||||
|
||||
interface E {}
|
||||
interface AE extends E {}
|
||||
|
||||
interface G<T extends E> {}
|
||||
interface AG<T extends AE> extends G<T> {}
|
||||
|
||||
}
|
||||
|
||||
+4
@@ -491,6 +491,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUncheckedConversionDuringProperTypeExpressionConstraintResolution() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user