FIR: Do not add alias for variables with explicit type
This commit is contained in:
committed by
TeamCityServer
parent
5317cf3af1
commit
a0a57581ec
@@ -0,0 +1,45 @@
|
||||
// SKIP_TXT
|
||||
// FILE: a/A.java
|
||||
package a;
|
||||
public interface A {
|
||||
B b();
|
||||
}
|
||||
|
||||
// FILE: a/B.java
|
||||
package a;
|
||||
public interface B {
|
||||
void bar();
|
||||
}
|
||||
|
||||
// FILE: a/AImpl.java
|
||||
package a;
|
||||
|
||||
public class AImpl implements A {
|
||||
@Override
|
||||
public BImpl b() {
|
||||
return new BImpl();
|
||||
}
|
||||
}
|
||||
|
||||
class BImpl implements B {
|
||||
@Override
|
||||
public void bar() {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import a.A
|
||||
import a.AImpl
|
||||
|
||||
fun test1(a: A) {
|
||||
if (a is AImpl) {
|
||||
(a as A).b().bar() // OK
|
||||
<!INACCESSIBLE_TYPE!><!DEBUG_INFO_SMARTCAST!>a<!>.b()<!>.<!INVISIBLE_MEMBER!>bar<!>()
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(aImpl: AImpl) {
|
||||
val a: A = aImpl
|
||||
(a <!USELESS_CAST!>as A<!>).b().bar() // OK
|
||||
a.b().bar() // Works at FE1.0, fails at FIR
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user