Added tests
#KT-6179 Fixed #KT-8132 Fixed
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// KT-8132 Can't omit lambda parameter types
|
||||
|
||||
fun <T> test(foo: List<T>): T {
|
||||
return if (true)
|
||||
throw IllegalStateException()
|
||||
else
|
||||
foo.reduce { left, right -> left } // error: inferred type T is not subtype Nothing
|
||||
}
|
||||
|
||||
fun <S, T: S> Iterable<T>.reduce(operation: (S, T) -> S): S = throw Exception()
|
||||
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
internal fun </*0*/ T> test(/*0*/ foo: kotlin.List<T>): T
|
||||
internal fun </*0*/ S, /*1*/ T : S> kotlin.Iterable<T>.reduce(/*0*/ operation: (S, T) -> S): S
|
||||
@@ -7175,6 +7175,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt8132.kt")
|
||||
public void testKt8132() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/regressions/kt8132.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt832.kt")
|
||||
public void testKt832() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/regressions/kt832.kt");
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
fun foo(c: Collection<String>) {
|
||||
val list = ArrayList<String>()
|
||||
c.filterTo0(<caret>)
|
||||
}
|
||||
|
||||
fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo0(destination: C, predicate: (T) -> Boolean): C = destination
|
||||
|
||||
//ELEMENT: list
|
||||
@@ -0,0 +1,10 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
fun foo(c: Collection<String>) {
|
||||
val list = ArrayList<String>()
|
||||
c.filterTo0(list)
|
||||
}
|
||||
|
||||
fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo0(destination: C, predicate: (T) -> Boolean): C = destination
|
||||
|
||||
//ELEMENT: list
|
||||
+6
@@ -443,6 +443,12 @@ public class SmartCompletionHandlerTestGenerated extends AbstractSmartCompletion
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6179filterTo.kt")
|
||||
public void testKt6179filterTo() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/smart/kt6179filterTo.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Lambda1.kt")
|
||||
public void testLambda1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/smart/Lambda1.kt");
|
||||
|
||||
Reference in New Issue
Block a user