mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 00:11:26 +07:00
new inference: infinite types
This commit is contained in:
+10
-1
@@ -1,7 +1,16 @@
|
||||
import java.util.List;
|
||||
|
||||
class Sample {
|
||||
<T extends List<K>, K extends List<T>> void foo(){}
|
||||
<T extends List<K>, K extends List<T>> T foo(){
|
||||
<error descr="Incompatible types. Found: 'K', required: 'T'">T t = foo().get(0);</error>
|
||||
<error descr="Incompatible types. Found: 'K', required: 'K'">K k = foo().get(0);</error>
|
||||
|
||||
<error descr="Incompatible types. Found: 'T', required: 'T'">T t1 = foo().get(0).get(0);</error>
|
||||
|
||||
String s = foo();
|
||||
<error descr="Incompatible types. Found: 'K', required: 'java.lang.String'">String s1 = foo().get(0);</error>
|
||||
return null;
|
||||
}
|
||||
|
||||
{
|
||||
foo();
|
||||
|
||||
+1
-1
@@ -3,5 +3,5 @@ import java.util.Map;
|
||||
public class SOE {
|
||||
|
||||
public static <K extends M, M extends Map<K,M>> M foo() {return null;}
|
||||
public static <K1 extends M1, M1 extends Map<K1,M1>> Map<K1, M1> foo1() {return <error descr="Inferred type 'java.util.Map<K1,M1>' for type parameter 'M' is not within its bound; should implement 'java.util.Map<java.util.Map<K1,M1>,java.util.Map<K1,M1>>'">foo()</error>;}
|
||||
public static <K1 extends M1, M1 extends Map<K1,M1>> Map<K1, M1> foo1() {<error descr="Incompatible types. Found: 'M', required: 'java.util.Map<K1,M1>'">return foo();</error>}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user