fix for NPE when lookup names in objects/closure in constructors #KT-2719 Fixed
This commit is contained in:
@@ -290,7 +290,7 @@ public abstract class CodegenContext {
|
||||
}
|
||||
|
||||
StackValue outer = getOuterExpression(null, ignoreNoOuter);
|
||||
result = result == null ? outer : StackValue.composed(result, outer);
|
||||
result = result == null || outer == null ? outer : StackValue.composed(result, outer);
|
||||
}
|
||||
|
||||
return parentContext != null ? parentContext.lookupInContext(d, result, state, ignoreNoOuter) : null;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Clazz {
|
||||
class object {
|
||||
val a = object {
|
||||
fun run(x: String) = x
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = "OK"
|
||||
@@ -84,6 +84,10 @@ public class ObjectGenTest extends CodegenTestCase {
|
||||
blackBoxFile("regressions/kt1737.kt");
|
||||
}
|
||||
|
||||
public void testK2719() {
|
||||
blackBoxFile("regressions/kt2719.kt");
|
||||
}
|
||||
|
||||
public void testReceiverInConstructor() {
|
||||
blackBoxFile("objects/receiverInConstructor.kt");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user