diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index c1c7353f4cd..41ccbc864dc 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -2122,7 +2122,7 @@ public class ExpressionCodegen extends KtVisitor impleme if (isBackingFieldInClassCompanion && forceField) { fieldAccessorKind = FieldAccessorKind.IN_CLASS_COMPANION; } - else if (syntheticBackingField && context.getParentContext().getContextDescriptor() != containingDeclaration) { + else if (syntheticBackingField && context.getFirstCrossInlineOrNonInlineContext().getParentContext().getContextDescriptor() != containingDeclaration) { fieldAccessorKind = FieldAccessorKind.FIELD_FROM_LOCAL; } boolean isStaticBackingField = DescriptorUtils.isStaticDeclaration(propertyDescriptor) || @@ -2163,13 +2163,7 @@ public class ExpressionCodegen extends KtVisitor impleme if (!skipPropertyAccessors) { if (!couldUseDirectAccessToProperty(propertyDescriptor, true, isDelegatedProperty, context)) { - if (isSuper && !isJvmInterface(containingDeclaration)) { - CodegenContext c = context.findParentContextWithDescriptor(superCallTarget); - assert c != null : "Couldn't find a context for a super-call: " + propertyDescriptor; - if (c != context.getParentContext()) { - propertyDescriptor = (PropertyDescriptor) c.getAccessor(propertyDescriptor, superCallTarget); - } - } + propertyDescriptor = context.getAccessorForSuperCallIfNeeded(propertyDescriptor, superCallTarget); propertyDescriptor = context.accessibleDescriptor(propertyDescriptor, superCallTarget); @@ -2327,15 +2321,8 @@ public class ExpressionCodegen extends KtVisitor impleme public StackValue invokeFunction(@NotNull Call call, @NotNull ResolvedCall resolvedCall, @NotNull StackValue receiver) { FunctionDescriptor fd = accessibleFunctionDescriptor(resolvedCall); ClassDescriptor superCallTarget = getSuperCallTarget(call); - boolean superCall = superCallTarget != null; - if (superCall && !isJvmInterface(fd.getContainingDeclaration())) { - CodegenContext c = context.findParentContextWithDescriptor(superCallTarget); - assert c != null : "Couldn't find a context for a super-call: " + fd; - if (c != context.getParentContext()) { - fd = (FunctionDescriptor) c.getAccessor(fd, superCallTarget); - } - } + fd = context.getAccessorForSuperCallIfNeeded(fd, superCallTarget); Collection codegenExtensions = ExpressionCodegenExtension.Companion.getInstances(state.getProject()); if (!codegenExtensions.isEmpty()) { @@ -2346,7 +2333,7 @@ public class ExpressionCodegen extends KtVisitor impleme } } - Callable callable = resolveToCallable(fd, superCall, resolvedCall); + Callable callable = resolveToCallable(fd, superCallTarget != null, resolvedCall); return callable.invokeMethodWithArguments(resolvedCall, receiver, this); } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java index 0118fedbe42..0307153dd91 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java @@ -134,12 +134,13 @@ public class JvmCodegenUtil { @NotNull PropertyDescriptor property, boolean forGetter, boolean isDelegated, - @NotNull MethodContext context + @NotNull MethodContext contextBeforeInline ) { if (JetTypeMapper.isAccessor(property)) return false; + CodegenContext context = contextBeforeInline.getFirstCrossInlineOrNonInlineContext(); // Inline functions can't use direct access because a field may not be visible at the call site - if (context.isInlineFunction()) { + if (context.isInlineMethodContext()) { return false; } @@ -164,7 +165,7 @@ public class JvmCodegenUtil { return Visibilities.isPrivate(property.getVisibility()) || accessor.getModality() == FINAL; } - private static boolean isDebuggerContext(@NotNull MethodContext context) { + private static boolean isDebuggerContext(@NotNull CodegenContext context) { KtFile file = DescriptorToSourceUtils.getContainingFile(context.getContextDescriptor()); return file != null && CodeFragmentUtilKt.getSuppressDiagnosticsInDebugMode(file); } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java index 22ecf7a1901..78048378147 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java @@ -37,6 +37,7 @@ import org.jetbrains.org.objectweb.asm.Type; import java.util.*; import static org.jetbrains.kotlin.codegen.AsmUtil.getVisibilityAccessFlag; +import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvmInterface; import static org.jetbrains.org.objectweb.asm.Opcodes.ACC_PRIVATE; import static org.jetbrains.org.objectweb.asm.Opcodes.ACC_PROTECTED; @@ -364,11 +365,24 @@ public abstract class CodegenContext { } @NotNull - public D getAccessor(@NotNull D descriptor, @Nullable ClassDescriptor superCallTarget) { + private D getAccessor(@NotNull D descriptor, @Nullable ClassDescriptor superCallTarget) { return getAccessor(descriptor, FieldAccessorKind.NORMAL, null, superCallTarget); } @SuppressWarnings("unchecked") + @NotNull + public D getAccessorForSuperCallIfNeeded(@NotNull D descriptor, @Nullable ClassDescriptor superCallTarget) { + if (superCallTarget != null && !isJvmInterface(descriptor.getContainingDeclaration())) { + CodegenContext afterInline = getFirstCrossInlineOrNonInlineContext(); + CodegenContext c = afterInline.findParentContextWithDescriptor(superCallTarget); + assert c != null : "Couldn't find a context for a super-call: " + descriptor; + if (c != afterInline.getParentContext()) { + return (D) c.getAccessor(descriptor, superCallTarget); + } + } + return descriptor; + } + @NotNull public D getAccessor( @NotNull D possiblySubstitutedDescriptor, @@ -506,21 +520,22 @@ public abstract class CodegenContext { return accessors == null ? Collections.>emptySet() : accessors.values(); } + @SuppressWarnings("unchecked") @NotNull public D accessibleDescriptor( @NotNull D descriptor, @Nullable ClassDescriptor superCallTarget ) { + CodegenContext properContext = getFirstCrossInlineOrNonInlineContext(); DeclarationDescriptor enclosing = descriptor.getContainingDeclaration(); - boolean isInliningContext = isInlineMethodContext(); + boolean isInliningContext = properContext.isInlineMethodContext(); if (!isInliningContext && ( - !hasThisDescriptor() || - enclosing == getThisDescriptor() || - enclosing == getClassOrPackageParentContext().getContextDescriptor())) { + !properContext.hasThisDescriptor() || + enclosing == properContext.getThisDescriptor() || + enclosing == properContext.getClassOrPackageParentContext().getContextDescriptor())) { return descriptor; } - - return accessibleDescriptorIfNeeded(descriptor, superCallTarget, isInliningContext); + return (D) properContext.accessibleDescriptorIfNeeded(descriptor, superCallTarget, isInliningContext); } @SuppressWarnings("unchecked") @@ -633,18 +648,25 @@ public abstract class CodegenContext { return value instanceof StackValue.Field && ((StackValue.Field) value).isStaticPut; } - private boolean isInsideInliningContext() { - CodegenContext current = this; - while (current != null) { - if (current instanceof MethodContext && ((MethodContext) current).isInlineFunction()) { - return true; - } - current = current.getParentContext(); - } - return false; - } - - private boolean isInlineMethodContext() { + public boolean isInlineMethodContext() { return this instanceof MethodContext && ((MethodContext) this).isInlineFunction(); } + + @NotNull + public CodegenContext getFirstCrossInlineOrNonInlineContext() { + if (!(this instanceof MethodContext)) { + return this; + } + MethodContext context = (MethodContext) this; + if (!context.isInliningLambda() || context.isCrossInline) { + return this; + } + + CodegenContext parent = context.getParentContext(); + assert parent instanceof ClosureContext : "Parent of inlining lambda body should be ClosureContext, but: " + parent; + + parent = parent.getParentContext(); + assert parent != null : "Parent context of lambda class context should exist: " + this.contextDescriptor; + return parent.getFirstCrossInlineOrNonInlineContext(); + } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/MethodContext.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/MethodContext.java index 3d3bb2b2a4f..cb5ed98e64f 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/MethodContext.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/MethodContext.java @@ -39,7 +39,7 @@ public class MethodContext extends CodegenContext { // Note: in case of code inside property accessors, functionDescriptor will be that accessor, // but CodegenContext#contextDescriptor will be the corresponding property private final FunctionDescriptor functionDescriptor; - private boolean isCrossInline; + public final boolean isCrossInline; protected MethodContext( @NotNull FunctionDescriptor functionDescriptor, diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.1.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.1.kt new file mode 100644 index 00000000000..d5e56940322 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.1.kt @@ -0,0 +1,25 @@ +import test.* + +class A { + + private val prop : String = "O" + get() = call {field + "K" } + + private val prop2 : String = "O" + get() = call { call {field + "K" } } + + fun test1(): String { + return prop + } + + fun test2(): String { + return prop2 + } + +} + +fun box(): String { + val a = A() + if (a.test1() != "OK") return "fail 1: ${a.test1()}" + return a.test2() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.2.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.2.kt new file mode 100644 index 00000000000..4409ed776a1 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.2.kt @@ -0,0 +1,5 @@ +package test + +inline fun call(s: () -> String): String { + return s() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.1.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.1.kt new file mode 100644 index 00000000000..0004e30d150 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.1.kt @@ -0,0 +1,26 @@ +//NO_CHECK_LAMBDA_INLINING +import test.* + +class A { + + private val prop : String = "O" + get() = call {field + "K" } + + private val prop2 : String = "O" + get() = call { call {field + "K" } } + + fun test1(): String { + return prop + } + + fun test2(): String { + return prop2 + } + +} + +fun box(): String { + val a = A() + if (a.test1() != "OK") return "fail 1: ${a.test1()}" + return a.test2() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.2.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.2.kt new file mode 100644 index 00000000000..8c459c68a29 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.2.kt @@ -0,0 +1,5 @@ +package test + +inline fun call(crossinline s: () -> String): String { + return { s() } () +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.1.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.1.kt new file mode 100644 index 00000000000..6f2859af978 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.1.kt @@ -0,0 +1,28 @@ +import test.* + +class A { + + private fun method() = "O" + + private val prop = "K" + + fun test1(): String { + return call { + method() + prop + } + } + + fun test2(): String { + return call { + call { + method() + prop + } + } + } +} + +fun box(): String { + val a = A() + if (a.test1() != "OK") return "fail 1: ${a.test1()}" + return a.test2() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.2.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.2.kt new file mode 100644 index 00000000000..4409ed776a1 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.2.kt @@ -0,0 +1,5 @@ +package test + +inline fun call(s: () -> String): String { + return s() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.1.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.1.kt new file mode 100644 index 00000000000..193c20681e1 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.1.kt @@ -0,0 +1,29 @@ +//NO_CHECK_LAMBDA_INLINING +import test.* + +class A { + + private fun method() = "O" + + private val prop = "K" + + fun test1(): String { + return call { + method() + prop + } + } + + fun test2(): String { + return call { + call { + method() + prop + } + } + } +} + +fun box(): String { + val a = A() + if (a.test1() != "OK") return "fail 1: ${a.test1()}" + return a.test2() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.2.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.2.kt new file mode 100644 index 00000000000..49bfcde205e --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.2.kt @@ -0,0 +1,7 @@ +package test + +inline fun call(crossinline s: () -> String): String { + return { + s() + }() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.1.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.1.kt new file mode 100644 index 00000000000..c4ae608d605 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.1.kt @@ -0,0 +1,28 @@ +import test.* + +class A : Base() { + + override fun method() = "fail method" + + override val prop = "fail property" + + fun test1(): String { + return call { + super.method() + super.prop + } + } + + fun test2(): String { + return call { + call { + super.method() + super.prop + } + } + } +} + +fun box(): String { + val a = A() + if (a.test1() != "OK") return "fail 1: ${a.test1()}" + return a.test2() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.2.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.2.kt new file mode 100644 index 00000000000..ece932aa21f --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.2.kt @@ -0,0 +1,12 @@ +package test + +inline fun call(s: () -> String): String { + return s() +} + +open class Base { + + protected open fun method(): String = "O" + + protected open val prop = "K" +} diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.1.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.1.kt new file mode 100644 index 00000000000..32f4b2e2c35 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.1.kt @@ -0,0 +1,29 @@ +//NO_CHECK_LAMBDA_INLINING +import test.* + +class A : Base() { + + override fun method() = "fail method" + + override val prop = "fail property" + + fun test1(): String { + return call { + super.method() + super.prop + } + } + + fun test2(): String { + return call { + call { + super.method() + super.prop + } + } + } +} + +fun box(): String { + val a = A() + if (a.test1() != "OK") return "fail 1: ${a.test1()}" + return a.test2() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.2.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.2.kt new file mode 100644 index 00000000000..d95a1adacc5 --- /dev/null +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.2.kt @@ -0,0 +1,14 @@ +package test + +inline fun call(crossinline s: () -> String): String { + return { + s() + }() +} + +open class Base { + + protected open fun method(): String = "O" + + protected open val prop = "K" +} diff --git a/compiler/testData/codegen/bytecodeText/inline/noSynAccessor.kt b/compiler/testData/codegen/bytecodeText/inline/noSynAccessor.kt new file mode 100644 index 00000000000..7481444d88f --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/inline/noSynAccessor.kt @@ -0,0 +1,28 @@ +inline fun call(s: () -> Unit) { + s() +} + +class A { + + private fun method() {} + + private val prop = 1 + + fun test1() { + call { + method() + prop + } + } + + fun test2() { + call { + call { + method() + prop + } + } + } +} + +//0 access\$ \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/inline/noSynAccessorToDirectFieldAccess.kt b/compiler/testData/codegen/bytecodeText/inline/noSynAccessorToDirectFieldAccess.kt new file mode 100644 index 00000000000..983be7b9c40 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/inline/noSynAccessorToDirectFieldAccess.kt @@ -0,0 +1,22 @@ +inline fun call(s: () -> String): String { + return s() +} + +class A { + + private val prop: String = "O" + get() = call { field + "K" } + + private val prop2: String = "O" + get() = call { call { field + "K" } } + + fun test1(): String { + return prop + } + + fun test2(): String { + return prop2 + } +} + +//0 access\$ \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/inline/noSynAccessorToSuper.kt b/compiler/testData/codegen/bytecodeText/inline/noSynAccessorToSuper.kt new file mode 100644 index 00000000000..4c2253533aa --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/inline/noSynAccessorToSuper.kt @@ -0,0 +1,36 @@ +inline fun call(s: () -> Unit) { + s() +} + +open class Base { + + protected open fun method() {} + + protected open val prop = 1 + +} + +class A: Base() { + + override fun method() {} + + override val prop = 1 + + fun test1() { + call { + super.method() + super.prop + } + } + + fun test2() { + call { + call { + super.method() + super.prop + } + } + } +} + +//0 access\$ \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index d056261655b..fdbb385e8e1 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -712,6 +712,24 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeText/inline"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("noSynAccessor.kt") + public void testNoSynAccessor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/inline/noSynAccessor.kt"); + doTest(fileName); + } + + @TestMetadata("noSynAccessorToDirectFieldAccess.kt") + public void testNoSynAccessorToDirectFieldAccess() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/inline/noSynAccessorToDirectFieldAccess.kt"); + doTest(fileName); + } + + @TestMetadata("noSynAccessorToSuper.kt") + public void testNoSynAccessorToSuper() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/inline/noSynAccessorToSuper.kt"); + doTest(fileName); + } + @TestMetadata("notSplitedExceptionTable.kt") public void testNotSplitedExceptionTable() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/inline/notSplitedExceptionTable.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxInlineCodegenTestGenerated.java index 4f122688194..ec1e3d331e7 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxInlineCodegenTestGenerated.java @@ -1680,6 +1680,51 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/superProperty.1.kt"); doTestMultiFileWithInlineCheck(fileName); } + + @TestMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class WithinInlineLambda extends AbstractBlackBoxInlineCodegenTest { + public void testAllFilesPresentInWithinInlineLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda"), Pattern.compile("^(.+)\\.1.kt$"), true); + } + + @TestMetadata("directFieldAccess.1.kt") + public void testDirectFieldAccess() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.1.kt"); + doTestMultiFileWithInlineCheck(fileName); + } + + @TestMetadata("directFieldAccessInCrossInline.1.kt") + public void testDirectFieldAccessInCrossInline() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.1.kt"); + doTestMultiFileWithInlineCheck(fileName); + } + + @TestMetadata("privateCall.1.kt") + public void testPrivateCall() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.1.kt"); + doTestMultiFileWithInlineCheck(fileName); + } + + @TestMetadata("privateInCrossInline.1.kt") + public void testPrivateInCrossInline() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.1.kt"); + doTestMultiFileWithInlineCheck(fileName); + } + + @TestMetadata("superCall.1.kt") + public void testSuperCall() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.1.kt"); + doTestMultiFileWithInlineCheck(fileName); + } + + @TestMetadata("superInCrossInline.1.kt") + public void testSuperInCrossInline() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.1.kt"); + doTestMultiFileWithInlineCheck(fileName); + } + } } @TestMetadata("compiler/testData/codegen/boxInline/trait") diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstInlineKotlinTestGenerated.java index 13a11639910..a1e161cea2c 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1680,6 +1680,51 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/superProperty.1.kt"); doBoxTestWithInlineCheck(fileName); } + + @TestMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class WithinInlineLambda extends AbstractCompileKotlinAgainstInlineKotlinTest { + public void testAllFilesPresentInWithinInlineLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda"), Pattern.compile("^(.+)\\.1.kt$"), true); + } + + @TestMetadata("directFieldAccess.1.kt") + public void testDirectFieldAccess() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.1.kt"); + doBoxTestWithInlineCheck(fileName); + } + + @TestMetadata("directFieldAccessInCrossInline.1.kt") + public void testDirectFieldAccessInCrossInline() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.1.kt"); + doBoxTestWithInlineCheck(fileName); + } + + @TestMetadata("privateCall.1.kt") + public void testPrivateCall() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.1.kt"); + doBoxTestWithInlineCheck(fileName); + } + + @TestMetadata("privateInCrossInline.1.kt") + public void testPrivateInCrossInline() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.1.kt"); + doBoxTestWithInlineCheck(fileName); + } + + @TestMetadata("superCall.1.kt") + public void testSuperCall() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.1.kt"); + doBoxTestWithInlineCheck(fileName); + } + + @TestMetadata("superInCrossInline.1.kt") + public void testSuperInCrossInline() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.1.kt"); + doBoxTestWithInlineCheck(fileName); + } + } } @TestMetadata("compiler/testData/codegen/boxInline/trait")