NI: don't do substitution for unsupported callable descriptors to use as callable references
^KT-41729 Fixed
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun a() {
|
||||
val x = 10
|
||||
foo(::x)
|
||||
}
|
||||
|
||||
fun foo(a: Any) {}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun a() {
|
||||
val x = 10
|
||||
foo(::<!UNSUPPORTED!>x<!>)
|
||||
}
|
||||
|
||||
fun foo(a: Any) {}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun a(): kotlin.Unit
|
||||
public fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun eat(value: Any) {}
|
||||
|
||||
fun test(param: String) {
|
||||
val a = ::param
|
||||
|
||||
val local = "local"
|
||||
val b = ::local
|
||||
|
||||
val lambda = { -> }
|
||||
val g = ::lambda
|
||||
|
||||
eat(::param)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun eat(value: Any) {}
|
||||
|
||||
fun test(param: String) {
|
||||
val a = ::<!UNSUPPORTED!>param<!>
|
||||
|
||||
val local = "local"
|
||||
val b = ::<!UNSUPPORTED!>local<!>
|
||||
|
||||
val lambda = { -> }
|
||||
val g = ::<!UNSUPPORTED!>lambda<!>
|
||||
|
||||
eat(::<!UNSUPPORTED!>param<!>)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun eat(/*0*/ value: kotlin.Any): kotlin.Unit
|
||||
public fun test(/*0*/ param: kotlin.String): kotlin.Unit
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// Issue: KT-41729
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Foo {
|
||||
operator fun <T> getValue(thisRef: Any?, property: KProperty<*>) = 1
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val f = Foo()
|
||||
val a: Int
|
||||
<!VARIABLE_EXPECTED!>get()<!> = f.getValue(null, ::a) // no exception after fix
|
||||
<!UNRESOLVED_REFERENCE!>print<!>(<!UNINITIALIZED_VARIABLE!>a<!>)
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Issue: KT-41729
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Foo {
|
||||
operator fun <T> getValue(thisRef: Any?, property: KProperty<*>) = 1
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val f = Foo()
|
||||
val a: Int
|
||||
<!UNRESOLVED_REFERENCE!>get<!>() = f.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getValue<!>(null, ::<!UNSUPPORTED!>a<!>) // no exception after fix
|
||||
<!UNRESOLVED_REFERENCE!>print<!>(<!UNINITIALIZED_VARIABLE!>a<!>)
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public final class Foo {
|
||||
public constructor Foo()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun </*0*/ T> getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Issue: KT-41729
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Foo {
|
||||
operator fun <T> getValue(thisRef: Any?, property: KProperty<*>) = 1
|
||||
}
|
||||
|
||||
fun main(x: Int) {
|
||||
val f = Foo()
|
||||
val a: Int
|
||||
<!VARIABLE_EXPECTED!>get()<!> = f.getValue(null, ::x) // no exception after fix
|
||||
<!UNRESOLVED_REFERENCE!>print<!>(<!UNINITIALIZED_VARIABLE!>a<!>)
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Issue: KT-41729
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Foo {
|
||||
operator fun <T> getValue(thisRef: Any?, property: KProperty<*>) = 1
|
||||
}
|
||||
|
||||
fun main(<!UNUSED_PARAMETER!>x<!>: Int) {
|
||||
val f = Foo()
|
||||
val a: Int
|
||||
<!UNRESOLVED_REFERENCE!>get<!>() = f.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getValue<!>(null, ::<!UNSUPPORTED!>x<!>) // no exception after fix
|
||||
<!UNRESOLVED_REFERENCE!>print<!>(<!UNINITIALIZED_VARIABLE!>a<!>)
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
|
||||
public final class Foo {
|
||||
public constructor Foo()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun </*0*/ T> getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// FILE: Customer.java
|
||||
public class Customer {
|
||||
private String name;
|
||||
|
||||
public Customer(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
val customerName = Customer::name
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// FILE: Customer.java
|
||||
public class Customer {
|
||||
private String name;
|
||||
|
||||
public Customer(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
val customerName = Customer::<!UNSUPPORTED!>name<!>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public val customerName: kotlin.reflect.KMutableProperty1<Customer, kotlin.String!>
|
||||
|
||||
public open class Customer {
|
||||
public constructor Customer(/*0*/ name: kotlin.String!)
|
||||
private final var name: kotlin.String!
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun getName(): kotlin.String!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun setName(/*0*/ name: kotlin.String!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user