K2: Fix internal error in FIR2IR caused by PCLA + String interpolation
There's an implicit contract in PCLA that the statement-level call should be postponed iff it has something to be postponed inside. And that contract didn't work well for string interpolation containing some postponed calls. Thus, we haven't run a completion results writing for them properly, thus leaving type parameters (K from synthetic call) for expression types instead of an inferred substituted type. In this commit, the contract was reversed to explicitly enumerate the cases when it's safe to resolve the candidate outside PCLA session. See the comments at `mightBeAnalyzedAndCompletedIndependently`. ^KT-65341 Fixed
This commit is contained in:
committed by
Space Team
parent
3ba8256b8d
commit
66d8f471d9
+12
@@ -2772,6 +2772,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
@@ -2802,6 +2808,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+12
@@ -2772,6 +2772,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
@@ -2802,6 +2808,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+12
@@ -2755,6 +2755,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
@@ -2785,6 +2791,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+12
@@ -2755,6 +2755,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
@@ -2785,6 +2791,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+12
@@ -2755,6 +2755,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
@@ -2785,6 +2791,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+89
-64
@@ -8,15 +8,13 @@ package org.jetbrains.kotlin.fir.resolve.inference
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.resolve.ResolutionMode
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.CallKind
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.candidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.processConstraintStorageFromExpression
|
||||
import org.jetbrains.kotlin.fir.resolve.inference.model.ConeExpectedTypeConstraintPosition
|
||||
import org.jetbrains.kotlin.fir.resolve.inference.model.ConeFixVariableConstraintPosition
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculator
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.addSubtypeConstraintIfCompatible
|
||||
@@ -38,8 +36,9 @@ class FirPCLAInferenceSession(
|
||||
private set
|
||||
|
||||
override fun baseConstraintStorageForCandidate(candidate: Candidate): ConstraintStorage? {
|
||||
if (candidate.needsToBePostponed()) return currentCommonSystem.currentStorage()
|
||||
return null
|
||||
if (candidate.mightBeAnalyzedAndCompletedIndependently()) return null
|
||||
|
||||
return currentCommonSystem.currentStorage()
|
||||
}
|
||||
|
||||
override fun customCompletionModeInsteadOfFull(
|
||||
@@ -191,56 +190,97 @@ class FirPCLAInferenceSession(
|
||||
return Pair(coneTypeVariableTypeConstructor, resultType)
|
||||
}
|
||||
|
||||
private fun FirExpression.doesArgumentLeadToCallPostponement(): Boolean {
|
||||
if (this is FirWrappedArgumentExpression) return expression.doesArgumentLeadToCallPostponement()
|
||||
/**
|
||||
* This function returns true only when it's safe & sound to analyze and complete the candidate outside the PCLA context,
|
||||
* i.e., independently of outer CS.
|
||||
*
|
||||
* That might be some plain variable accesses that do not contain type variables or regular function calls with only trivial arguments.
|
||||
*
|
||||
* The basic purpose of that function is performance enhancement because resolving all the calls inside PCLA lambda in the outer context
|
||||
* might be too much.
|
||||
*
|
||||
* Mostly, that means that this function might always return false and it should be correct.
|
||||
* TODO: Currently, making it always returning "false" leads to few test failures
|
||||
* TODO: due to some corner cases like annotations calls (KT-65465)
|
||||
*/
|
||||
private fun Candidate.mightBeAnalyzedAndCompletedIndependently(): Boolean {
|
||||
when (callInfo.resolutionMode) {
|
||||
// Currently, we handle delegates specifically, not completing them even if they are trivial function calls
|
||||
// Thus they are being resolved in the context of outer CS
|
||||
is ResolutionMode.Delegate -> return false
|
||||
is ResolutionMode.WithExpectedType -> when {
|
||||
// For assignments like myVarContainingTV = SomeCallWithNonTrivialInference(...)
|
||||
// We should integrate even simple calls into the PCLA tree, too
|
||||
callInfo.resolutionMode.expectedTypeRef.type.containsNotFixedTypeVariables() -> return false
|
||||
}
|
||||
is ResolutionMode.WithStatus, is ResolutionMode.LambdaResolution ->
|
||||
error("$this call should not be analyzed in ${callInfo.resolutionMode}")
|
||||
|
||||
if (doesArgumentUseOuterCS()) return true
|
||||
if (isQualifiedAccessContainingTypeVariables()) return true
|
||||
|
||||
// Postponed atoms
|
||||
if (this is FirAnonymousFunctionExpression) return true
|
||||
if (this is FirCallableReferenceAccess) return true
|
||||
if (this is FirAnonymousObjectExpression) return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private fun Candidate.needsToBePostponed(): Boolean {
|
||||
if (dispatchReceiver?.isReceiverPostponed() == true) return true
|
||||
if (givenExtensionReceiverOptions.any { it.isReceiverPostponed() }) return true
|
||||
|
||||
if (callInfo.arguments.any { it.doesArgumentLeadToCallPostponement() }) return true
|
||||
|
||||
if (callInfo.callKind == CallKind.VariableAccess) {
|
||||
val returnType = (symbol as? FirVariableSymbol)?.let(returnTypeCalculator::tryCalculateReturnType)
|
||||
if (returnType?.type?.containsNotFixedTypeVariables() == true) return true
|
||||
}
|
||||
|
||||
if (callInfo.resolutionMode is ResolutionMode.Delegate) return true
|
||||
|
||||
// For assignments like myVarContainingTV = SomeCallWithNonTrivialInference(...)
|
||||
// We should integrate the call into the PCLA tree, too
|
||||
if ((callInfo.resolutionMode as? ResolutionMode.WithExpectedType)?.expectedTypeRef?.type?.containsNotFixedTypeVariables() == true) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Synthetic calls with blocks work like lambdas
|
||||
if (callInfo.callKind == CallKind.SyntheticSelect) return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private fun FirExpression.doesArgumentUseOuterCS(): Boolean {
|
||||
var result = false
|
||||
processConstraintStorageFromExpression(this) {
|
||||
if (it.usesOuterCs) {
|
||||
result = true
|
||||
is ResolutionMode.AssignmentLValue,
|
||||
is ResolutionMode.ContextDependent,
|
||||
is ResolutionMode.ContextIndependent,
|
||||
is ResolutionMode.ReceiverResolution,
|
||||
-> {
|
||||
// Regular cases, just continue execution.
|
||||
// Enumerating all the cases just to make sure we don't forget to handle some mode.
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
val callSite = callInfo.callSite
|
||||
// Annotation calls and collection literals (allowed only inside annotations)
|
||||
// should be completed independently since that can't somehow affect PCLA
|
||||
if (callSite is FirAnnotationCall || callSite is FirArrayLiteral) return true
|
||||
|
||||
// I'd say that this might be an assertion, but let's do an early return
|
||||
if (callSite !is FirResolvable && callSite !is FirVariableAssignment) return false
|
||||
|
||||
// We can't analyze independently the calls which have postponed receivers
|
||||
// Even if the calls themselves are trivial
|
||||
if (dispatchReceiver?.isReceiverPostponed() == true) return false
|
||||
if (givenExtensionReceiverOptions.any { it.isReceiverPostponed() }) return false
|
||||
|
||||
// Accesses to local variables or local functions which return types contain not fixed TVs
|
||||
val returnType = (symbol as? FirCallableSymbol)?.let(returnTypeCalculator::tryCalculateReturnType)
|
||||
if (returnType?.type?.containsNotFixedTypeVariables() == true) return false
|
||||
|
||||
// Now, we've got some sort of call/variable access/callable reference/synthetic call (see hierarchy of FirResolvable)
|
||||
// It has regular independent receivers and trivial return type
|
||||
// The only thing we need to check if it has only trivial arguments
|
||||
if (callInfo.arguments.any { !it.isTrivialArgument() }) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun FirExpression.isTrivialArgument(): Boolean =
|
||||
when (this) {
|
||||
// Callable references might be unresolved at this stage, so obtaining `resolvedType` would lead to exceptions
|
||||
// Anyway, they should lead to integrated resolution of containing call
|
||||
is FirCallableReferenceAccess -> false
|
||||
|
||||
is FirResolvable -> when (val candidate = candidate()) {
|
||||
null -> !resolvedType.containsNotFixedTypeVariables()
|
||||
else -> !candidate.usedOuterCs
|
||||
}
|
||||
|
||||
is FirWrappedExpression -> expression.isTrivialArgument()
|
||||
is FirSamConversionExpression -> expression.isTrivialArgument()
|
||||
is FirSmartCastExpression -> originalExpression.isTrivialArgument()
|
||||
|
||||
is FirCall -> argumentList.arguments.all { it.isTrivialArgument() }
|
||||
|
||||
is FirBinaryLogicExpression -> leftOperand.isTrivialArgument() && rightOperand.isTrivialArgument()
|
||||
is FirComparisonExpression -> compareToCall.isTrivialArgument()
|
||||
|
||||
is FirCheckedSafeCallSubject -> originalReceiverRef.value.isTrivialArgument()
|
||||
is FirSafeCallExpression -> receiver.isTrivialArgument() && (selector as? FirExpression)?.isTrivialArgument() == true
|
||||
is FirVarargArgumentsExpression -> arguments.all { it.isTrivialArgument() }
|
||||
|
||||
is FirLiteralExpression<*>, is FirResolvedQualifier, is FirResolvedReifiedParameterReference -> true
|
||||
|
||||
// Be default, we consider all the unknown cases as unsafe to resolve independently
|
||||
else -> false
|
||||
}
|
||||
|
||||
private fun FirExpression.isReceiverPostponed(): Boolean {
|
||||
if (resolvedType.containsNotFixedTypeVariables()) return true
|
||||
if ((this as? FirResolvable)?.candidate()?.usedOuterCs == true) return true
|
||||
@@ -248,21 +288,6 @@ class FirPCLAInferenceSession(
|
||||
return false
|
||||
}
|
||||
|
||||
private fun FirExpression.isQualifiedAccessContainingTypeVariables(): Boolean {
|
||||
if (this is FirNamedArgumentExpression) return expression.isQualifiedAccessContainingTypeVariables()
|
||||
|
||||
if (!isQualifiedAccessOrSmartCastOnIt()) return false
|
||||
if (this is FirCallableReferenceAccess) return false
|
||||
|
||||
return resolvedType.containsNotFixedTypeVariables() && (this as? FirResolvable)?.candidate() == null
|
||||
}
|
||||
|
||||
private fun FirExpression.isQualifiedAccessOrSmartCastOnIt(): Boolean = when (this) {
|
||||
is FirQualifiedAccessExpression -> true
|
||||
is FirSmartCastExpression -> originalExpression.isQualifiedAccessOrSmartCastOnIt()
|
||||
else -> false
|
||||
}
|
||||
|
||||
private fun ConeKotlinType.containsNotFixedTypeVariables(): Boolean =
|
||||
contains {
|
||||
// TODO: Investigate why using `notFixedTypeVariables` instead of `allTypeVariables` leads to failure of the test (KT-64861)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
MODULE main
|
||||
CLASS Kt65341Kt$nodeTransformer$1.class
|
||||
K1
|
||||
---
|
||||
K2
|
||||
invoke(LNodeTransformer1;)Lkotlin/Unit; [public, final]
|
||||
K1
|
||||
invoke(LNodeTransformer1;)V [public, final]
|
||||
K2
|
||||
---
|
||||
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// ISSUE: KT-65341
|
||||
// JVM_ABI_K1_K2_DIFF: KT-65386
|
||||
|
||||
val nodeTransformer =
|
||||
single {
|
||||
fun getConstructorParameterValue(kParameter: String) {
|
||||
if (true) {
|
||||
throw java.lang.IllegalStateException("${kParameter!!}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <Output> single(
|
||||
singleConstructor: (NodeTransformer1<Output>) -> Output?
|
||||
) {
|
||||
}
|
||||
|
||||
class NodeTransformer1<Output>
|
||||
|
||||
fun box(): String {
|
||||
// Just making sure that for the original case the whole compiler pipeline is successfully completed
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
// ISSUE: KT-65341
|
||||
class Controller<K> {
|
||||
fun yield(k: K) {}
|
||||
}
|
||||
|
||||
fun <T> generate(lambda: Controller<T>.() -> Unit) {}
|
||||
|
||||
fun bar(x: String) {}
|
||||
|
||||
var v: String = "OK"
|
||||
|
||||
fun foo0(x: String?) {
|
||||
generate {
|
||||
bar("$v abc${x!!}")
|
||||
|
||||
yield("")
|
||||
}
|
||||
}
|
||||
|
||||
fun foo1(x: String?) {
|
||||
generate {
|
||||
bar("$v abc${when { x != null -> x else -> null}}")
|
||||
|
||||
yield("")
|
||||
}
|
||||
}
|
||||
|
||||
fun <E> id(e: E): E = e
|
||||
|
||||
fun foo2(x: String?) {
|
||||
generate {
|
||||
bar("$v abc${id(this)}")
|
||||
|
||||
yield("")
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo0(null)
|
||||
foo1(null)
|
||||
foo2(null)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
-54
@@ -1,54 +0,0 @@
|
||||
FILE fqName:<root> fileName:/posptonedPCLACallInsideStringInterpolation.kt
|
||||
CLASS CLASS name:Controller modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Controller<K of <root>.Controller>
|
||||
TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Controller<K of <root>.Controller> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Controller modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:yield visibility:public modality:FINAL <> ($this:<root>.Controller<K of <root>.Controller>, k:K of <root>.Controller) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Controller<K of <root>.Controller>
|
||||
VALUE_PARAMETER name:k index:0 type:K of <root>.Controller
|
||||
BLOCK_BODY
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:generate visibility:public modality:FINAL <T> (lambda:@[ExtensionFunctionType] kotlin.Function1<<root>.Controller<T of <root>.generate>, kotlin.Unit>) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
VALUE_PARAMETER name:lambda index:0 type:@[ExtensionFunctionType] kotlin.Function1<<root>.Controller<T of <root>.generate>, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
FUN name:id visibility:public modality:FINAL <E> (e:E of <root>.id) returnType:E of <root>.id
|
||||
TYPE_PARAMETER name:E index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
VALUE_PARAMETER name:e index:0 type:E of <root>.id
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun id <E> (e: E of <root>.id): E of <root>.id declared in <root>'
|
||||
GET_VAR 'e: E of <root>.id declared in <root>.id' type=E of <root>.id origin=null
|
||||
FUN name:bar visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:s index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun generate <T> (lambda: @[ExtensionFunctionType] kotlin.Function1<<root>.Controller<T of <root>.generate>, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: kotlin.String
|
||||
lambda: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.Controller<kotlin.String>, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.Controller<kotlin.String>) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:$this$generate type:<root>.Controller<kotlin.String>
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun bar (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
s: STRING_CONCATENATION type=kotlin.String
|
||||
CALL 'public final fun id <E> (e: E of <root>.id): E of <root>.id declared in <root>' type=E of <root>.id origin=null
|
||||
<E>: IrErrorType(null)
|
||||
e: GET_VAR '$this$generate: <root>.Controller<kotlin.String> declared in <root>.foo.<anonymous>' type=<root>.Controller<kotlin.String> origin=null
|
||||
CALL 'public final fun yield (k: K of <root>.Controller): kotlin.Unit declared in <root>.Controller' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR '$this$generate: <root>.Controller<kotlin.String> declared in <root>.foo.<anonymous>' type=<root>.Controller<kotlin.String> origin=null
|
||||
k: CONST String type=kotlin.String value=""
|
||||
Vendored
-29
@@ -1,29 +0,0 @@
|
||||
class Controller<K : Any?> {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun yield(k: K) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <T : Any?> generate(lambda: @ExtensionFunctionType Function1<Controller<T>, Unit>) {
|
||||
}
|
||||
|
||||
fun <E : Any?> id(e: E): E {
|
||||
return e
|
||||
}
|
||||
|
||||
fun bar(s: String) {
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
generate<String>(lambda = local fun Controller<String>.<anonymous>() {
|
||||
bar(s = id<ErrorType>(e = $this$generate))
|
||||
$this$generate.yield(k = "")
|
||||
}
|
||||
)
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-65341
|
||||
class Controller<K> {
|
||||
fun yield(k: K) {}
|
||||
|
||||
+12
@@ -2755,6 +2755,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
@@ -2785,6 +2791,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+12
@@ -2575,6 +2575,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
@@ -2605,6 +2611,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+12
@@ -2755,6 +2755,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
@@ -2785,6 +2791,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+12
@@ -2755,6 +2755,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
@@ -2785,6 +2791,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+10
@@ -2403,6 +2403,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builderInference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt65341.kt")
|
||||
public void testKt65341() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/kt65341.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaParameterHasTVType.kt")
|
||||
public void testLambdaParameterHasTVType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/lambdaParameterHasTVType.kt");
|
||||
@@ -2428,6 +2433,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/receiverUsesOuterTVButReturnTypeIsProper.kt");
|
||||
|
||||
+6
@@ -1891,6 +1891,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
Generated
+6
@@ -1891,6 +1891,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+6
@@ -1891,6 +1891,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+6
@@ -1891,6 +1891,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+6
@@ -1950,6 +1950,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+6
@@ -1996,6 +1996,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+6
@@ -1904,6 +1904,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
+6
@@ -1951,6 +1951,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
Generated
+6
@@ -1879,6 +1879,12 @@ public class FirWasmJsCodegenBoxTestGenerated extends AbstractFirWasmJsCodegenBo
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
Generated
+6
@@ -1879,6 +1879,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
|
||||
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
|
||||
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user