mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
completion: presume fresh variables have always low bounds during completion
IDEA-190041
This commit is contained in:
+5
@@ -66,4 +66,9 @@ public class CompletionParameterTypeInferencePolicy extends ProcessCandidatePara
|
||||
public boolean isVarargsIgnored() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inferLowerBoundForFreshVariables() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -42,4 +42,13 @@ public abstract class ParameterTypeInferencePolicy {
|
||||
public boolean isVarargsIgnored() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* For infinite type declarations, like {@code Foo<T extends Foo<T>>}, inference introduces fake fresh "fixed" type parameters.
|
||||
* These fresh parameters respect constraints, created during inference session. For completion, it makes sense to define lower bounds
|
||||
* even if no appropriate constraints were detected, as probably the corresponding argument is currently completed.
|
||||
*/
|
||||
public boolean inferLowerBoundForFreshVariables() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
|
||||
interface Foo<T extends Foo<T>> {
|
||||
|
||||
static <F extends Foo<F>> void foo(F f) {
|
||||
bar(f);<caret>
|
||||
}
|
||||
|
||||
static <B extends Foo<B>> void bar(B b) { }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
|
||||
interface Foo<T extends Foo<T>> {
|
||||
|
||||
static <F extends Foo<F>> void foo(F f) {
|
||||
bar(<caret>);
|
||||
}
|
||||
|
||||
static <B extends Foo<B>> void bar(B b) { }
|
||||
}
|
||||
+5
@@ -224,6 +224,11 @@ public void testConvertToObjectStream() {
|
||||
myFixture.complete(CompletionType.SMART, 1);
|
||||
checkResultByFile("/" + getTestName(false) + "-out.java");
|
||||
}
|
||||
public void testLowerBoundOfFreshVariable() {
|
||||
configureByTestName();
|
||||
myFixture.complete(CompletionType.SMART, 1);
|
||||
checkResultByFile("/" + getTestName(false) + "-out.java");
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
|
||||
Reference in New Issue
Block a user