mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
Correctly map declaration owner in JVM codegen
"context.contextKind()" was incorrect in ExpressionCodegen.intermediateValueForProperty(), because it represents the context of the call site, not the context of the property declaration #KT-4878 Fixed
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
class MyWrongClass : FieldAccess() {
|
||||
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val clazz = MyWrongClass()
|
||||
clazz.fieldO = "O"
|
||||
FieldAccess.fieldK = "K"
|
||||
return clazz.fieldO!! + FieldAccess.fieldK!!
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
public class fieldAccessFromExtensionInTraitImpl {
|
||||
public final String result = "OK";
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// KT-4878
|
||||
|
||||
import fieldAccessFromExtensionInTraitImpl as D
|
||||
|
||||
trait T {
|
||||
fun Int.foo(d: D) = d.result!!
|
||||
}
|
||||
|
||||
class A : T {
|
||||
fun bar() = 42.foo(D())
|
||||
}
|
||||
|
||||
fun box() = A().bar()
|
||||
@@ -1,5 +1,5 @@
|
||||
class FieldAccess {
|
||||
class fieldAccessViaSubclass {
|
||||
public String fieldO;
|
||||
|
||||
public static String fieldK;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// KT-3492
|
||||
|
||||
class MyWrongClass : fieldAccessViaSubclass() {
|
||||
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val clazz = MyWrongClass()
|
||||
clazz.fieldO = "O"
|
||||
fieldAccessViaSubclass.fieldK = "K"
|
||||
return clazz.fieldO!! + fieldAccessViaSubclass.fieldK!!
|
||||
}
|
||||
Reference in New Issue
Block a user