fix for NPE when lookup names in objects/closure in constructors #KT-2719 Fixed

This commit is contained in:
Alex Tkachman
2012-09-11 16:15:35 +03:00
parent bb92655ecd
commit ec549895e8
3 changed files with 14 additions and 1 deletions
@@ -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");
}