mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 23:39:39 +07:00
new inference: use site substitution inside one level of inference only so calls with different site substitutions are possible in one expression (IDEA-131723; IDEA-131562)
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
//expected type parameter
|
||||
class Sample<V> {
|
||||
|
||||
public <K> Map<V, K> test() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> void fun(T t, V v) {
|
||||
}
|
||||
|
||||
<M> M bar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void run(Sample<Integer> sample) {
|
||||
fun(test(), bar());
|
||||
sample.fun(test(), sample.bar());
|
||||
sample.fun(test(), bar());
|
||||
fun(test(), sample.bar());
|
||||
|
||||
fun(sample.test(), bar());
|
||||
fun(sample.test(), sample.bar());
|
||||
sample.fun(sample.test(), bar());
|
||||
sample.fun(sample.test(), sample.bar());
|
||||
}
|
||||
}
|
||||
|
||||
//expected generic type
|
||||
class Sample1<T> {
|
||||
public <S extends T> List<S> reverse() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void foo(Sample1<Comparable> t)
|
||||
{
|
||||
newTreeSet(t.reverse());
|
||||
newTreeSet(reverse());
|
||||
|
||||
t.newTreeSet(t.reverse());
|
||||
t.newTreeSet(reverse());
|
||||
}
|
||||
|
||||
|
||||
public <E> void newTreeSet(List<E> comparator) {}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class MyTest1 {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
m<error descr="Ambiguous method call: both 'MyTest1.m(I1)' and 'MyTest1.m(I2)' match">(Foo::new)</error>;
|
||||
m<error descr="Ambiguous method call: both 'MyTest1.m(I2)' and 'MyTest1.m(I3)' match">(Foo::new)</error>;
|
||||
}
|
||||
}
|
||||
class MyTest2 {
|
||||
@@ -104,6 +104,6 @@ class MyTest2 {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
m<error descr="Ambiguous method call: both 'MyTest2.m(I1)' and 'MyTest2.m(I2)' match">(Foo::new)</error>;
|
||||
m<error descr="Ambiguous method call: both 'MyTest2.m(I2)' and 'MyTest2.m(I3)' match">(Foo::new)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user