tests added
for inference for delegated properties
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package foo
|
||||
|
||||
class A1 {
|
||||
val a: String by MyProperty1()
|
||||
}
|
||||
|
||||
class MyProperty1 {}
|
||||
fun MyProperty1.get(thisRef: Any?, desc: PropertyMetadata): String {
|
||||
throw Exception("$thisRef $desc")
|
||||
}
|
||||
|
||||
//--------------------
|
||||
|
||||
class A2 {
|
||||
val a: String by MyProperty2()
|
||||
}
|
||||
|
||||
class MyProperty2<T> {}
|
||||
fun <T> MyProperty2<T>.get(thisRef: Any?, desc: PropertyMetadata): T {
|
||||
throw Exception("$thisRef $desc")
|
||||
}
|
||||
|
||||
//--------------------
|
||||
|
||||
class A3 {
|
||||
val a: String by MyProperty3()
|
||||
|
||||
class MyProperty3<T> {}
|
||||
|
||||
fun <T> MyProperty3<T>.get(thisRef: Any?, desc: PropertyMetadata): T {
|
||||
throw Exception("$thisRef $desc")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package foo
|
||||
|
||||
open class A {
|
||||
val B.w: Int by <!TYPE_INFERENCE_UPPER_BOUND_VIOLATED!>MyProperty<!>()
|
||||
}
|
||||
|
||||
val A.e: Int by MyProperty()
|
||||
|
||||
class B {
|
||||
val A.f: Int by MyProperty()
|
||||
}
|
||||
|
||||
class MyProperty<R : A, T> {
|
||||
public fun get(thisRef: R, desc: PropertyMetadata): T {
|
||||
throw Exception("$thisRef $desc")
|
||||
}
|
||||
}
|
||||
@@ -2065,6 +2065,16 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
doTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionGet.kt")
|
||||
public void testExtensionGet() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionProperty.kt")
|
||||
public void testExtensionProperty() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noErrorsForImplicitConstraints.kt")
|
||||
public void testNoErrorsForImplicitConstraints() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt");
|
||||
|
||||
Reference in New Issue
Block a user