Add one more test on delegated properties to check NI
This commit is contained in:
Vendored
+22
@@ -0,0 +1,22 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
fun test(i: Int) {
|
||||||
|
val bad by myLazyDelegate {
|
||||||
|
createSample(i) { it.toString() }
|
||||||
|
}
|
||||||
|
|
||||||
|
takeSample(bad)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> myLazyDelegate(i: () -> T): LazyDelegate<T> = LazyDelegate(i())
|
||||||
|
|
||||||
|
class LazyDelegate<T>(val v: T) {
|
||||||
|
operator fun getValue(thisRef: Any?, property: KProperty<*>): T = TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Sample<K, V>
|
||||||
|
|
||||||
|
fun takeSample(g: Sample<Int, String>) {}
|
||||||
|
fun <T, S> createSample(i: T, a: (T) -> S): Sample<T, S> = TODO()
|
||||||
Vendored
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun </*0*/ T, /*1*/ S> createSample(/*0*/ i: T, /*1*/ a: (T) -> S): Sample<T, S>
|
||||||
|
public fun </*0*/ T> myLazyDelegate(/*0*/ i: () -> T): LazyDelegate<T>
|
||||||
|
public fun takeSample(/*0*/ g: Sample<kotlin.Int, kotlin.String>): kotlin.Unit
|
||||||
|
public fun test(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
|
||||||
|
public final class LazyDelegate</*0*/ T> {
|
||||||
|
public constructor LazyDelegate</*0*/ T>(/*0*/ v: T)
|
||||||
|
public final val v: T
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): T
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Sample</*0*/ K, /*1*/ V> {
|
||||||
|
public constructor Sample</*0*/ K, /*1*/ V>()
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -6223,6 +6223,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/delegatedProperty/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/delegatedProperty/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("delegateExpressionAsLambda.kt")
|
||||||
|
public void testDelegateExpressionAsLambda() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/inference/delegateExpressionAsLambda.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("differentDelegatedExpressions.kt")
|
@TestMetadata("differentDelegatedExpressions.kt")
|
||||||
public void testDifferentDelegatedExpressions() throws Exception {
|
public void testDifferentDelegatedExpressions() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt");
|
||||||
|
|||||||
Generated
+6
@@ -6223,6 +6223,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/delegatedProperty/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/delegatedProperty/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("delegateExpressionAsLambda.kt")
|
||||||
|
public void testDelegateExpressionAsLambda() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/inference/delegateExpressionAsLambda.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("differentDelegatedExpressions.kt")
|
@TestMetadata("differentDelegatedExpressions.kt")
|
||||||
public void testDifferentDelegatedExpressions() throws Exception {
|
public void testDifferentDelegatedExpressions() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user