[NI] Report unstable smart cast directly instead of using SmartCastManager
Fix compilation errors, revealed by this fix. SmartCastManager is unnecessary for error reporting, intermediate diagnostics from the NI contain all required infromation. When SmartCastManager is used it leads to missing unstable smart casts in case of expressions with captured types. This happens, because data flow info is recorded for original expression without captured types, which is used as a key. DataFlowValues created from receivers with captured types can't be used to retrieve that info. ^KT-39010 Fixed
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
class A<E> {
|
||||
fun foo(): E = TODO()
|
||||
}
|
||||
|
||||
class B(var a: A<*>?) {
|
||||
fun bar() {
|
||||
if (a != null) {
|
||||
a.<!INAPPLICABLE_CANDIDATE!>foo<!>()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class A<E> {
|
||||
fun foo(): E = TODO()
|
||||
}
|
||||
|
||||
class B(var a: A<*>?) {
|
||||
fun bar() {
|
||||
if (a != null) {
|
||||
<!SMARTCAST_IMPOSSIBLE!>a<!>.foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public final class A</*0*/ E> {
|
||||
public constructor A</*0*/ E>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): E
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B {
|
||||
public constructor B(/*0*/ a: A<*>?)
|
||||
public final var a: A<*>?
|
||||
public final fun bar(): kotlin.Unit
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
open class A<E> {
|
||||
}
|
||||
|
||||
class B : A<String>() {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
interface KI {
|
||||
val a: A<*>
|
||||
}
|
||||
|
||||
fun KI.bar() {
|
||||
if (a is B) {
|
||||
a.<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
open class A<E> {
|
||||
}
|
||||
|
||||
class B : A<String>() {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
interface KI {
|
||||
val a: A<*>
|
||||
}
|
||||
|
||||
fun KI.bar() {
|
||||
if (a is B) {
|
||||
<!SMARTCAST_IMPOSSIBLE!>a<!>.foo()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun KI.bar(): kotlin.Unit
|
||||
|
||||
public open class A</*0*/ E> {
|
||||
public constructor A</*0*/ E>()
|
||||
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
|
||||
}
|
||||
|
||||
public final class B : A<kotlin.String> {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface KI {
|
||||
public abstract val a: A<*>
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user