Import all components and delegates accessors if possible

This commit is contained in:
Nikolay Krasko
2015-10-23 16:07:38 +03:00
parent 1517a099d0
commit 3c07bc3df7
10 changed files with 489 additions and 110 deletions
@@ -0,0 +1,42 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Missing 'getValue(testing.BigTest, kotlin.reflect.KProperty<*>)' method on delegate of type 'some.DelegateImpl<kotlin.Int>'
// ERROR: Missing 'setValue(testing.BigTest, kotlin.reflect.KProperty<*>, [ERROR : Type from delegate])' method on delegate of type 'some.DelegateImpl<kotlin.Int>'
package testing
import some.DelegateImpl
class BigTest {
var a by <caret>DelegateImpl<Int>()
}
// FILE: second.kt
package some
class DelegateImpl<T> {
val value: T = null!!
}
public fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
public fun <T> DelegateImpl<T>.setValue(thisRef: Any, propertyMetadata: PropertyMetadata, t: T) {}
// FILE: first.after.kt
// "Import" "true"
// ERROR: Missing 'getValue(testing.BigTest, kotlin.reflect.KProperty<*>)' method on delegate of type 'some.DelegateImpl<kotlin.Int>'
// ERROR: Missing 'setValue(testing.BigTest, kotlin.reflect.KProperty<*>, [ERROR : Type from delegate])' method on delegate of type 'some.DelegateImpl<kotlin.Int>'
package testing
import some.DelegateImpl
import some.getValue
import some.setValue
class BigTest {
var a by <caret>DelegateImpl<Int>()
}
@@ -0,0 +1,44 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
package testing
import some.Some
fun testing() {
val (a, b) = <caret>Some()
}
//-----------------------
// FILE: second.kt
// "Import" "true"
package some
public class Some
operator fun Some.component1() = 1
operator fun Some.component2() = 3
//-----------------------
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
package testing
import some.Some
import some.component1
import some.component2
fun testing() {
val (a, b) = <caret>Some()
}
//-----------------------
@@ -0,0 +1,53 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
package testing
import some.Some
fun testing() {
val (a, b) = <caret>Some()
}
//-----------------------
// FILE: second.kt
package some
public class Some
operator fun Some.component1() = 1
operator fun Some.component2() = 3
//-----------------------
// FILE: second.kt
package other
import some.Some
operator fun Some.component1() = 1
operator fun Some.component2() = 3
//-----------------------
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
package testing
import some.Some
import some.component1
import some.component2
fun testing() {
val (a, b) = <caret>Some()
}
//-----------------------
@@ -0,0 +1,52 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
package testing
import some.Some
fun testing() {
val (a, b) = <caret>Some()
}
//-----------------------
// FILE: second.kt
package some
public class Some
operator fun Some.component1() = 1
operator fun Some.component2() = 3
//-----------------------
// FILE: second.kt
package other
import some.Some
operator fun Some.component1() = 1
//-----------------------
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
package testing
import some.Some
import some.component1
import some.component2
fun testing() {
val (a, b) = <caret>Some()
}
//-----------------------
@@ -0,0 +1,54 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type aaa.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type aaa.Some must have a 'component2()' function
package testing
import aaa.Some
fun testing() {
val (a, b) = <caret>Some()
}
//-----------------------
// FILE: second.kt
package aaa
public class Some
@Deprecated("Use componenents from other")
operator fun Some.component1() = 1
operator fun Some.component2() = 3
//-----------------------
// FILE: second.kt
package other
import aaa.Some
operator fun Some.component1() = 1
operator fun Some.component2() = 3
//-----------------------
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type aaa.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type aaa.Some must have a 'component2()' function
package testing
import aaa.Some
import other.component1
import other.component2
fun testing() {
val (a, b) = <caret>Some()
}
//-----------------------