Create resolution context for delegated property resolve as well
^KT-48445 Fixed
This commit is contained in:
+6
@@ -18157,6 +18157,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt48445.kt")
|
||||||
|
public void testKt48445() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt48445.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
|||||||
import org.jetbrains.kotlin.resolve.calls.checkers.OperatorCallChecker
|
import org.jetbrains.kotlin.resolve.calls.checkers.OperatorCallChecker
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession
|
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer
|
import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency
|
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem
|
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemCompleter
|
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemCompleter
|
||||||
@@ -40,6 +42,7 @@ import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults
|
|||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||||
import org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver
|
import org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.util.CallMaker
|
||||||
import org.jetbrains.kotlin.resolve.constants.IntegerLiteralTypeConstructor
|
import org.jetbrains.kotlin.resolve.constants.IntegerLiteralTypeConstructor
|
||||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||||
import org.jetbrains.kotlin.resolve.scopes.ScopeUtils
|
import org.jetbrains.kotlin.resolve.scopes.ScopeUtils
|
||||||
@@ -692,7 +695,9 @@ class DelegatedPropertyResolver(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val resolutionCallbacks = psiCallResolver.createResolutionCallbacks(trace, newInferenceSession, context = null)
|
val call = CallMaker.makeCall(delegateExpression, receiver)
|
||||||
|
val resolutionContext = BasicCallResolutionContext.create(context, call, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS)
|
||||||
|
val resolutionCallbacks = psiCallResolver.createResolutionCallbacks(trace, newInferenceSession, resolutionContext)
|
||||||
val resolutionResults = newInferenceSession.resolveCandidates(resolutionCallbacks)
|
val resolutionResults = newInferenceSession.resolveCandidates(resolutionCallbacks)
|
||||||
|
|
||||||
for ((name, isGet) in listOf(OperatorNameConventions.GET_VALUE to true, OperatorNameConventions.SET_VALUE to false)) {
|
for ((name, isGet) in listOf(OperatorNameConventions.GET_VALUE to true, OperatorNameConventions.SET_VALUE to false)) {
|
||||||
|
|||||||
+2
-5
@@ -71,7 +71,7 @@ class KotlinResolutionCallbacksImpl(
|
|||||||
private val doubleColonExpressionResolver: DoubleColonExpressionResolver,
|
private val doubleColonExpressionResolver: DoubleColonExpressionResolver,
|
||||||
private val deprecationResolver: DeprecationResolver,
|
private val deprecationResolver: DeprecationResolver,
|
||||||
private val moduleDescriptor: ModuleDescriptor,
|
private val moduleDescriptor: ModuleDescriptor,
|
||||||
private val topLevelCallContext: BasicCallResolutionContext?,
|
private val topLevelCallContext: BasicCallResolutionContext,
|
||||||
private val missingSupertypesResolver: MissingSupertypesResolver
|
private val missingSupertypesResolver: MissingSupertypesResolver
|
||||||
) : KotlinResolutionCallbacks {
|
) : KotlinResolutionCallbacks {
|
||||||
class LambdaInfo(val expectedType: UnwrappedType, val contextDependency: ContextDependency) {
|
class LambdaInfo(val expectedType: UnwrappedType, val contextDependency: ContextDependency) {
|
||||||
@@ -160,8 +160,6 @@ class KotlinResolutionCallbacksImpl(
|
|||||||
|
|
||||||
val coroutineSession =
|
val coroutineSession =
|
||||||
if (stubsForPostponedVariables.isNotEmpty()) {
|
if (stubsForPostponedVariables.isNotEmpty()) {
|
||||||
require(topLevelCallContext != null) { "Top level call context should not be null to analyze coroutine-lambda" }
|
|
||||||
|
|
||||||
BuilderInferenceSession(
|
BuilderInferenceSession(
|
||||||
psiCallResolver, postponedArgumentsAnalyzer, kotlinConstraintSystemCompleter,
|
psiCallResolver, postponedArgumentsAnalyzer, kotlinConstraintSystemCompleter,
|
||||||
callComponents, builtIns, topLevelCallContext, stubsForPostponedVariables, trace,
|
callComponents, builtIns, topLevelCallContext, stubsForPostponedVariables, trace,
|
||||||
@@ -303,8 +301,7 @@ class KotlinResolutionCallbacksImpl(
|
|||||||
|
|
||||||
override fun disableContractsIfNecessary(resolvedAtom: ResolvedCallAtom) {
|
override fun disableContractsIfNecessary(resolvedAtom: ResolvedCallAtom) {
|
||||||
val atom = resolvedAtom.atom as? PSIKotlinCall ?: return
|
val atom = resolvedAtom.atom as? PSIKotlinCall ?: return
|
||||||
val context = topLevelCallContext ?: return
|
disableContractsInsideContractsBlock(atom.psiCall, resolvedAtom.candidateDescriptor, topLevelCallContext.scope, trace)
|
||||||
disableContractsInsideContractsBlock(atom.psiCall, resolvedAtom.candidateDescriptor, context.scope, trace)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun convertSignedConstantToUnsigned(argument: KotlinCallArgument): IntegerValueTypeConstant? {
|
override fun convertSignedConstantToUnsigned(argument: KotlinCallArgument): IntegerValueTypeConstant? {
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class PSICallResolver(
|
|||||||
private fun createResolutionCallbacks(context: BasicCallResolutionContext) =
|
private fun createResolutionCallbacks(context: BasicCallResolutionContext) =
|
||||||
createResolutionCallbacks(context.trace, context.inferenceSession, context)
|
createResolutionCallbacks(context.trace, context.inferenceSession, context)
|
||||||
|
|
||||||
fun createResolutionCallbacks(trace: BindingTrace, inferenceSession: InferenceSession, context: BasicCallResolutionContext?) =
|
fun createResolutionCallbacks(trace: BindingTrace, inferenceSession: InferenceSession, context: BasicCallResolutionContext) =
|
||||||
KotlinResolutionCallbacksImpl(
|
KotlinResolutionCallbacksImpl(
|
||||||
trace, expressionTypingServices, typeApproximator,
|
trace, expressionTypingServices, typeApproximator,
|
||||||
argumentTypeResolver, languageVersionSettings, kotlinToResolvedCallTransformer,
|
argumentTypeResolver, languageVersionSettings, kotlinToResolvedCallTransformer,
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||||
|
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
internal class TowerDataElementsForName() {
|
||||||
|
val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
|
buildList {
|
||||||
|
for (i in lastIndex downTo 0) {
|
||||||
|
add("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//internal class TowerDataElementsForName2() {
|
||||||
|
// @OptIn(ExperimentalStdlibApi::class)
|
||||||
|
// val reversedFilteredLocalScopes = buildList {
|
||||||
|
// val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
|
// @OptIn(ExperimentalStdlibApi::class)
|
||||||
|
// buildList {
|
||||||
|
// for (i in lastIndex downTo 0) {
|
||||||
|
// add("")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// add(reversedFilteredLocalScopes)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//internal class TowerDataElementsForName3() {
|
||||||
|
// val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
|
// @OptIn(ExperimentalStdlibApi::class)
|
||||||
|
// buildList l1@ {
|
||||||
|
// for (i in lastIndex downTo 0) {
|
||||||
|
// val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
|
// @OptIn(ExperimentalStdlibApi::class)
|
||||||
|
// buildList {
|
||||||
|
// for (i in lastIndex downTo 0) {
|
||||||
|
// add("")
|
||||||
|
// this@l1.add("")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
// mute due to KT-48633
|
||||||
|
//internal class TowerDataElementsForName4() {
|
||||||
|
// @OptIn(ExperimentalStdlibApi::class)
|
||||||
|
// val reversedFilteredLocalScopes = buildList l1@ {
|
||||||
|
// class Foo {
|
||||||
|
// val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
|
// @OptIn(ExperimentalStdlibApi::class)
|
||||||
|
// buildList {
|
||||||
|
// for (i in lastIndex downTo 0) {
|
||||||
|
// add("")
|
||||||
|
// this@l1.add("")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val x1 = TowerDataElementsForName().reversedFilteredLocalScopes
|
||||||
|
// val x2 = TowerDataElementsForName2().reversedFilteredLocalScopes
|
||||||
|
// val x3 = TowerDataElementsForName3().reversedFilteredLocalScopes
|
||||||
|
// val x4 = TowerDataElementsForName4().reversedFilteredLocalScopes
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+6
@@ -18037,6 +18037,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt48445.kt")
|
||||||
|
public void testKt48445() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt48445.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
|
|||||||
+6
@@ -18157,6 +18157,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt48445.kt")
|
||||||
|
public void testKt48445() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt48445.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
|
|||||||
+5
@@ -14945,6 +14945,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt48445.kt")
|
||||||
|
public void testKt48445() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt48445.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -13054,6 +13054,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt48445.kt")
|
||||||
|
public void testKt48445() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt48445.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
||||||
|
|||||||
Generated
+5
@@ -12460,6 +12460,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt48445.kt")
|
||||||
|
public void testKt48445() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt48445.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
||||||
|
|||||||
Generated
+5
@@ -12505,6 +12505,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47744.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt48445.kt")
|
||||||
|
public void testKt48445() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt48445.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user