[NI] Fix diagnostic reporting and unveil problem wrt captured types
This commit is contained in:
+1
-1
@@ -6,6 +6,6 @@ import java.util.stream.IntStream
|
||||
|
||||
fun main() {
|
||||
val xs = IntStream.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>range<!>(0, 10).mapToObj { it.toString() }
|
||||
.collect(Collectors.toList())
|
||||
.collect(<!NI;NEW_INFERENCE_ERROR!>Collectors.toList()<!>)
|
||||
xs[0]
|
||||
}
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
fun <T> foo(array: Array<Array<T>>): Array<Array<T>> = array
|
||||
|
||||
fun test(array: Array<Array<out Int>>) {
|
||||
<!OI;TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>foo<!>(array)
|
||||
<!OI;TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>foo<!>(<!NI;NEW_INFERENCE_ERROR!>array<!>)
|
||||
|
||||
val f: Array<out Array<out Int>> = <!OI;TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>foo<!>(<!OI;TYPE_MISMATCH!>array<!>)
|
||||
val f: Array<out Array<out Int>> = <!OI;TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>foo<!>(<!NI;NEW_INFERENCE_ERROR, OI;TYPE_MISMATCH!>array<!>)
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -11,8 +11,8 @@ fun bar(b: B<in A<out Number>>, bOut: B<out A<out Number>>, bOut2: B<out A<Numbe
|
||||
foo(b)
|
||||
foo<Number>(b)
|
||||
|
||||
<!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>baz<!>(bOut)
|
||||
baz<Number>(<!OI;TYPE_MISMATCH!>bOut<!>)
|
||||
<!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>baz<!>(<!NI;NEW_INFERENCE_ERROR!>bOut<!>)
|
||||
baz<Number>(<!NI;NEW_INFERENCE_ERROR, OI;TYPE_MISMATCH!>bOut<!>)
|
||||
|
||||
baz(bOut2)
|
||||
baz<Number>(bOut2)
|
||||
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class Inv<T, K>
|
||||
|
||||
fun <K> createInv(): Inv<*, K> = TODO()
|
||||
|
||||
fun <T> foo(i: Inv<T, String>) {}
|
||||
|
||||
fun foo() {
|
||||
foo(<!NEW_INFERENCE_ERROR!>createInv()<!>)
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K> createInv(): Inv<*, K>
|
||||
public fun foo(): kotlin.Unit
|
||||
public fun </*0*/ T> foo(/*0*/ i: Inv<T, kotlin.String>): kotlin.Unit
|
||||
|
||||
public final class Inv</*0*/ T, /*1*/ K> {
|
||||
public constructor Inv</*0*/ T, /*1*/ K>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -59,9 +59,9 @@ fun test1(int: Int, any: Any) {
|
||||
writeToMyList(getMyListToWriteTo(any), int)
|
||||
<!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>writeToMyList<!>(getMyListToWriteTo(int), any)
|
||||
|
||||
readFromMyList(getMyListToWriteTo(any), any)
|
||||
readFromMyList(<!NI;NEW_INFERENCE_ERROR!>getMyListToWriteTo(any)<!>, any)
|
||||
|
||||
<!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>writeToMyList<!>(getMyListToReadFrom(any), any)
|
||||
<!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>writeToMyList<!>(<!NI;NEW_INFERENCE_ERROR!>getMyListToReadFrom(any)<!>, any)
|
||||
|
||||
use(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import java.util.stream.Collectors
|
||||
import java.util.stream.Stream
|
||||
|
||||
fun test(a: Stream<String>) {
|
||||
a.collect(Collectors.toList()) checkType { _<MutableList<String>>() }
|
||||
a.collect(<!NI;NEW_INFERENCE_ERROR!>Collectors.toList()<!>) checkType { _<MutableList<String>>() }
|
||||
// actually the inferred type is platform
|
||||
a.collect(Collectors.toList()) checkType { _<List<String?>>() }
|
||||
a.collect(<!NI;NEW_INFERENCE_ERROR!>Collectors.toList()<!>) checkType { _<List<String?>>() }
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@ interface A : Collection<String> {
|
||||
}
|
||||
|
||||
fun foo(x: List<String>, y: A) {
|
||||
x.stream().filter { it.length > 0 }.collect(Collectors.toList())
|
||||
x.stream().filter { it.length > 0 }.collect(<!NI;NEW_INFERENCE_ERROR!>Collectors.toList()<!>)
|
||||
y.stream().filter { it.length > 0 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user