[FIR] take ready implicit unit type instead of return type calculation
and assert that symbol is not a substitution/intersection override in the `compute` method otherwise. Because `fakeOverrideSubstitution` should be calculated for all real implicit types, no call to this method should actually happen. Otherwise, it can be problematic to create a session which would contain the full designation path: `provider.getFirCallableContainerFile(symbol)` returns `firFile` of a super class which might be from module `a`, when declaration and its outer classes are from module `b`. ^KTIJ-24105
This commit is contained in:
+6
@@ -784,6 +784,12 @@ public class Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated extends A
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/smartCastImplicitExtensionReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("substituteOverrideResolution.kt")
|
||||
public void testSubstituteOverrideResolution() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/substituteOverrideResolution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypeCallEntryResolveToCallInfo.kt")
|
||||
public void testSuperTypeCallEntryResolveToCallInfo() throws Exception {
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.test.cases.generated.cases.components.callResolver;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.fir.test.configurators.AnalysisApiFirTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.callResolver.AbstractMultiModuleResolveCallTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/multiModuleCallResolver/resolveCall")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirIdeNormalAnalysisSourceModuleMultiModuleResolveCallTestGenerated extends AbstractMultiModuleResolveCallTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Ide
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInResolveCall() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/multiModuleCallResolver/resolveCall"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeSubstituteOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideFromOtherModule() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/multiModuleCallResolver/resolveCall/implicitTypeSubstituteOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unitTypeFromOtherModule.kt")
|
||||
public void testUnitTypeFromOtherModule() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/multiModuleCallResolver/resolveCall/unitTypeFromOtherModule.kt");
|
||||
}
|
||||
}
|
||||
+6
@@ -784,6 +784,12 @@ public class FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated extends Ab
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/smartCastImplicitExtensionReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("substituteOverrideResolution.kt")
|
||||
public void testSubstituteOverrideResolution() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/substituteOverrideResolution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypeCallEntryResolveToCallInfo.kt")
|
||||
public void testSuperTypeCallEntryResolveToCallInfo() throws Exception {
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.callResolver
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.calls.KtCallInfo
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.stringRepresentation
|
||||
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedTest
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.ktModuleProvider
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.expressionMarkerProvider
|
||||
import org.jetbrains.kotlin.analysis.test.framework.utils.executeOnPooledThreadInReadAction
|
||||
import org.jetbrains.kotlin.psi.KtCallElement
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.services.TestModuleStructure
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.assertions
|
||||
|
||||
abstract class AbstractMultiModuleResolveCallTest : AbstractAnalysisApiBasedTest() {
|
||||
final override fun doTestByModuleStructure(moduleStructure: TestModuleStructure, testServices: TestServices) {
|
||||
val (expression, _) = moduleStructure.modules.flatMap { module ->
|
||||
val ktFiles = testServices.ktModuleProvider.getModuleFiles(module).filterIsInstance<KtFile>()
|
||||
testServices.expressionMarkerProvider.getElementsOfTypeAtCarets<KtExpression>(ktFiles)
|
||||
}.single()
|
||||
|
||||
val actual = executeOnPooledThreadInReadAction {
|
||||
analyseForTest(expression) {
|
||||
resolveCall(expression)?.let { stringRepresentation(it) }
|
||||
}
|
||||
} ?: "null"
|
||||
testServices.assertions.assertEqualsToTestDataFileSibling(actual)
|
||||
}
|
||||
|
||||
private fun KtAnalysisSession.resolveCall(element: PsiElement): KtCallInfo? = when (element) {
|
||||
is KtCallElement -> element.resolveCall()
|
||||
is KtElement -> element.resolveCall()
|
||||
else -> error("Selected element type (${element::class.simpleName}) is not supported for resolveCall()")
|
||||
}
|
||||
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.standalone.fir.test.cases.generated.cases.components.callResolver;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.standalone.fir.test.AnalysisApiFirStandaloneModeTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.callResolver.AbstractMultiModuleResolveCallTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/multiModuleCallResolver/resolveCall")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirStandaloneNormalAnalysisSourceModuleMultiModuleResolveCallTestGenerated extends AbstractMultiModuleResolveCallTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirStandaloneModeTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Standalone
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInResolveCall() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/multiModuleCallResolver/resolveCall"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeSubstituteOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideFromOtherModule() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/multiModuleCallResolver/resolveCall/implicitTypeSubstituteOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unitTypeFromOtherModule.kt")
|
||||
public void testUnitTypeFromOtherModule() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/multiModuleCallResolver/resolveCall/unitTypeFromOtherModule.kt");
|
||||
}
|
||||
}
|
||||
+6
@@ -784,6 +784,12 @@ public class FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated ext
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/smartCastImplicitExtensionReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("substituteOverrideResolution.kt")
|
||||
public void testSubstituteOverrideResolution() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/substituteOverrideResolution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypeCallEntryResolveToCallInfo.kt")
|
||||
public void testSuperTypeCallEntryResolveToCallInfo() throws Exception {
|
||||
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// WITH_STDLIB
|
||||
package main
|
||||
|
||||
import kotlin.collections.MutableList
|
||||
|
||||
abstract class B : MutableList<String>() {}
|
||||
|
||||
fun usage(b : B?) {
|
||||
if (b != null) {
|
||||
<expr>b.clear()</expr>
|
||||
}
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtSmartCastedReceiverValue:
|
||||
original = KtExplicitReceiverValue:
|
||||
expression = b
|
||||
isSafeNavigation = false
|
||||
type = main.B?
|
||||
type = main.B
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = kotlin/collections/MutableList.clear(<dispatch receiver>: kotlin.collections.MutableList<E>): kotlin.Unit
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = kotlin/collections/MutableList.clear
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// MODULE: lib
|
||||
package dependency
|
||||
|
||||
abstract class A<T> {
|
||||
fun foo() = ""
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: B.kt
|
||||
package main
|
||||
import c.C
|
||||
import dependency.A
|
||||
|
||||
abstract class B : A<C>() {}
|
||||
|
||||
fun usage(b : B?) {
|
||||
if (b != null) {
|
||||
b.f<caret>oo()
|
||||
}
|
||||
}
|
||||
// FILE: C.kt
|
||||
package c
|
||||
class C
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtSmartCastedReceiverValue:
|
||||
original = KtExplicitReceiverValue:
|
||||
expression = b
|
||||
isSafeNavigation = false
|
||||
type = main.B?
|
||||
type = main.B
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.String
|
||||
symbol = dependency/A.foo(<dispatch receiver>: dependency.A<T>): kotlin.String
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = dependency/A.foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// MODULE: lib
|
||||
package dependency
|
||||
|
||||
abstract class A<T> {
|
||||
abstract fun foo()
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: B.kt
|
||||
package main
|
||||
import c.C
|
||||
import dependency.A
|
||||
|
||||
abstract class B : A<C>() {}
|
||||
|
||||
fun usage(b : B?) {
|
||||
if (b != null) {
|
||||
b.f<caret>oo()
|
||||
}
|
||||
}
|
||||
// FILE: C.kt
|
||||
package c
|
||||
class C
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtSmartCastedReceiverValue:
|
||||
original = KtExplicitReceiverValue:
|
||||
expression = b
|
||||
isSafeNavigation = false
|
||||
type = main.B?
|
||||
type = main.B
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = dependency/A.foo(<dispatch receiver>: dependency.A<T>): kotlin.Unit
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = dependency/A.foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+30
@@ -278,6 +278,24 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeIntersectionOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeIntersectionOverrideFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeIntersectionOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeSubstituteOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeSubstituteOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeSubstituteOverrideInNestedClassFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideInNestedClassFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeSubstituteOverrideInNestedClassFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeWithTypeBound.kt")
|
||||
public void testImplicitTypeWithTypeBound() throws Exception {
|
||||
@@ -638,6 +656,18 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/typesInLocalFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unitTypeFromOtherModule.kt")
|
||||
public void testUnitTypeFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/unitTypeFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unitTypeSubstituteOverrideInNestedClassFromOtherModule.kt")
|
||||
public void testUnitTypeSubstituteOverrideInNestedClassFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/unitTypeSubstituteOverrideInNestedClassFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("varargInPrimaryConstructor.kt")
|
||||
public void testVarargInPrimaryConstructor() throws Exception {
|
||||
|
||||
+25
@@ -239,6 +239,21 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitTypeIntersectionOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeIntersectionOverrideFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeIntersectionOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitTypeSubstituteOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeSubstituteOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitTypeSubstituteOverrideInNestedClassFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideInNestedClassFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeSubstituteOverrideInNestedClassFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitTypeWithTypeBound.kt")
|
||||
public void testImplicitTypeWithTypeBound() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeWithTypeBound.kt");
|
||||
@@ -539,6 +554,16 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/typesInLocalFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unitTypeFromOtherModule.kt")
|
||||
public void testUnitTypeFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/unitTypeFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unitTypeSubstituteOverrideInNestedClassFromOtherModule.kt")
|
||||
public void testUnitTypeSubstituteOverrideInNestedClassFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/unitTypeSubstituteOverrideInNestedClassFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varargInPrimaryConstructor.kt")
|
||||
public void testVarargInPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/varargInPrimaryConstructor.kt");
|
||||
|
||||
compiler/fir/analysis-tests/testData/resolve/implicitTypeIntersectionOverrideFromOtherModule.fir.txt
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
Module: lib
|
||||
FILE: module_lib_implicitTypeIntersectionOverrideFromOtherModule.kt
|
||||
package dependency
|
||||
|
||||
public abstract class A : R|kotlin/Any| {
|
||||
public constructor(): R|dependency/A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface I : R|kotlin/Any| {
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
Module: main
|
||||
FILE: B.kt
|
||||
package main
|
||||
|
||||
public abstract class B : R|dependency/A|, R|dependency/I| {
|
||||
public constructor(): R|main/B| {
|
||||
super<R|dependency/A|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun usage(b: R|main/B?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(R|<local>/b|, Null(null)) -> {
|
||||
R|<local>/b|.R|dependency/A.foo|()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// SKIP_JAVAC
|
||||
// This directive is needed to skip this test in LazyBodyIsNotTouchedTilContractsPhaseTestGenerated,
|
||||
// because it fails to parse module structure of multimodule test
|
||||
|
||||
// MODULE: lib
|
||||
package dependency
|
||||
|
||||
abstract class A {
|
||||
abstract fun foo()
|
||||
}
|
||||
interface I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: B.kt
|
||||
package main
|
||||
import dependency.A
|
||||
import dependency.I
|
||||
|
||||
abstract class B : A(), I {}
|
||||
|
||||
fun usage(b : B?) {
|
||||
if (b != null) {
|
||||
b.foo()
|
||||
}
|
||||
}
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
Module: lib
|
||||
FILE: module_lib_implicitTypeSubstituteOverrideFromOtherModule.kt
|
||||
package dependency
|
||||
|
||||
public abstract class A<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|dependency/A<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/String| {
|
||||
^foo String()
|
||||
}
|
||||
|
||||
}
|
||||
Module: main
|
||||
FILE: B.kt
|
||||
package main
|
||||
|
||||
public abstract class B : R|dependency/A<c/C>| {
|
||||
public constructor(): R|main/B| {
|
||||
super<R|dependency/A<c/C>|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun usage(b: R|main/B?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(R|<local>/b|, Null(null)) -> {
|
||||
R|<local>/b|.R|SubstitutionOverride<main/B.foo: R|kotlin/String|>|()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
FILE: C.kt
|
||||
package c
|
||||
|
||||
public final class C : R|kotlin/Any| {
|
||||
public constructor(): R|c/C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// SKIP_JAVAC
|
||||
// This directive is needed to skip this test in LazyBodyIsNotTouchedTilContractsPhaseTestGenerated,
|
||||
// because it fails to parse module structure of multimodule test
|
||||
|
||||
// MODULE: lib
|
||||
package dependency
|
||||
|
||||
abstract class A<T> {
|
||||
fun foo() = ""
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: B.kt
|
||||
package main
|
||||
import c.C
|
||||
import dependency.A
|
||||
|
||||
abstract class B : A<C>() {}
|
||||
|
||||
fun usage(b : B?) {
|
||||
if (b != null) {
|
||||
b.foo()
|
||||
}
|
||||
}
|
||||
// FILE: C.kt
|
||||
package c
|
||||
class C
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
Module: lib
|
||||
FILE: module_lib_implicitTypeSubstituteOverrideInNestedClassFromOtherModule.kt
|
||||
package dependency
|
||||
|
||||
public abstract class A<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|dependency/A<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/String| {
|
||||
^foo String()
|
||||
}
|
||||
|
||||
}
|
||||
Module: main
|
||||
FILE: B.kt
|
||||
package main
|
||||
|
||||
public final class D : R|kotlin/Any| {
|
||||
public constructor(): R|main/D| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public abstract class B : R|dependency/A<c/C>| {
|
||||
public constructor(): R|main/D.B| {
|
||||
super<R|dependency/A<c/C>|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun usage(b: R|main/D.B?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(R|<local>/b|, Null(null)) -> {
|
||||
R|<local>/b|.R|SubstitutionOverride<main/D.B.foo: R|kotlin/String|>|()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
FILE: C.kt
|
||||
package c
|
||||
|
||||
public final class C : R|kotlin/Any| {
|
||||
public constructor(): R|c/C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// SKIP_JAVAC
|
||||
// This directive is needed to skip this test in LazyBodyIsNotTouchedTilContractsPhaseTestGenerated,
|
||||
// because it fails to parse module structure of multimodule test
|
||||
|
||||
// MODULE: lib
|
||||
package dependency
|
||||
|
||||
abstract class A<T> {
|
||||
fun foo() = ""
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: B.kt
|
||||
package main
|
||||
import c.C
|
||||
import dependency.A
|
||||
|
||||
class D {
|
||||
abstract class B : A<C>() {}
|
||||
}
|
||||
|
||||
fun usage(b : D.B?) {
|
||||
if (b != null) {
|
||||
b.foo()
|
||||
}
|
||||
}
|
||||
// FILE: C.kt
|
||||
package c
|
||||
class C
|
||||
@@ -0,0 +1,39 @@
|
||||
Module: lib
|
||||
FILE: module_lib_unitTypeFromOtherModule.kt
|
||||
package dependency
|
||||
|
||||
public abstract class A<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|dependency/A<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
Module: main
|
||||
FILE: B.kt
|
||||
package main
|
||||
|
||||
public abstract class B : R|dependency/A<c/C>| {
|
||||
public constructor(): R|main/B| {
|
||||
super<R|dependency/A<c/C>|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun usage(b: R|main/B?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(R|<local>/b|, Null(null)) -> {
|
||||
R|<local>/b|.R|SubstitutionOverride<main/B.foo: R|kotlin/Unit|>|()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
FILE: C.kt
|
||||
package c
|
||||
|
||||
public final class C : R|kotlin/Any| {
|
||||
public constructor(): R|c/C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// SKIP_JAVAC
|
||||
// This directive is needed to skip this test in LazyBodyIsNotTouchedTilContractsPhaseTestGenerated,
|
||||
// because it fails to parse module structure of multimodule test
|
||||
|
||||
// MODULE: lib
|
||||
package dependency
|
||||
|
||||
abstract class A<T> {
|
||||
abstract fun foo()
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: B.kt
|
||||
package main
|
||||
import c.C
|
||||
import dependency.A
|
||||
|
||||
abstract class B : A<C>() {}
|
||||
|
||||
fun usage(b : B?) {
|
||||
if (b != null) {
|
||||
b.foo()
|
||||
}
|
||||
}
|
||||
// FILE: C.kt
|
||||
package c
|
||||
class C
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
Module: lib
|
||||
FILE: module_lib_unitTypeSubstituteOverrideInNestedClassFromOtherModule.kt
|
||||
package dependency
|
||||
|
||||
public abstract class A<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|dependency/A<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
Module: main
|
||||
FILE: B.kt
|
||||
package main
|
||||
|
||||
public final class D : R|kotlin/Any| {
|
||||
public constructor(): R|main/D| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public abstract class B : R|dependency/A<c/C>| {
|
||||
public constructor(): R|main/D.B| {
|
||||
super<R|dependency/A<c/C>|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun usage(b: R|main/D.B?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(R|<local>/b|, Null(null)) -> {
|
||||
R|<local>/b|.R|SubstitutionOverride<main/D.B.foo: R|kotlin/Unit|>|()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
FILE: C.kt
|
||||
package c
|
||||
|
||||
public final class C : R|kotlin/Any| {
|
||||
public constructor(): R|c/C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// SKIP_JAVAC
|
||||
// This directive is needed to skip this test in LazyBodyIsNotTouchedTilContractsPhaseTestGenerated,
|
||||
// because it fails to parse module structure of multimodule test
|
||||
|
||||
// MODULE: lib
|
||||
package dependency
|
||||
|
||||
abstract class A<T> {
|
||||
abstract fun foo()
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: B.kt
|
||||
package main
|
||||
import c.C
|
||||
import dependency.A
|
||||
|
||||
class D {
|
||||
abstract class B : A<C>() {}
|
||||
}
|
||||
|
||||
fun usage(b : D.B?) {
|
||||
if (b != null) {
|
||||
b.foo()
|
||||
}
|
||||
}
|
||||
// FILE: C.kt
|
||||
package c
|
||||
class C
|
||||
+30
@@ -278,6 +278,24 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeIntersectionOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeIntersectionOverrideFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeIntersectionOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeSubstituteOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeSubstituteOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeSubstituteOverrideInNestedClassFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideInNestedClassFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeSubstituteOverrideInNestedClassFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeWithTypeBound.kt")
|
||||
public void testImplicitTypeWithTypeBound() throws Exception {
|
||||
@@ -638,6 +656,18 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/typesInLocalFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unitTypeFromOtherModule.kt")
|
||||
public void testUnitTypeFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/unitTypeFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unitTypeSubstituteOverrideInNestedClassFromOtherModule.kt")
|
||||
public void testUnitTypeSubstituteOverrideInNestedClassFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/unitTypeSubstituteOverrideInNestedClassFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("varargInPrimaryConstructor.kt")
|
||||
public void testVarargInPrimaryConstructor() throws Exception {
|
||||
|
||||
+30
@@ -278,6 +278,24 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeIntersectionOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeIntersectionOverrideFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeIntersectionOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeSubstituteOverrideFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeSubstituteOverrideFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeSubstituteOverrideInNestedClassFromOtherModule.kt")
|
||||
public void testImplicitTypeSubstituteOverrideInNestedClassFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeSubstituteOverrideInNestedClassFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitTypeWithTypeBound.kt")
|
||||
public void testImplicitTypeWithTypeBound() throws Exception {
|
||||
@@ -638,6 +656,18 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/typesInLocalFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unitTypeFromOtherModule.kt")
|
||||
public void testUnitTypeFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/unitTypeFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unitTypeSubstituteOverrideInNestedClassFromOtherModule.kt")
|
||||
public void testUnitTypeSubstituteOverrideInNestedClassFromOtherModule() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/unitTypeSubstituteOverrideInNestedClassFromOtherModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("varargInPrimaryConstructor.kt")
|
||||
public void testVarargInPrimaryConstructor() throws Exception {
|
||||
|
||||
+4
@@ -285,9 +285,13 @@ private class ReturnTypeCalculatorWithJump(
|
||||
|
||||
@OptIn(PrivateForInline::class)
|
||||
private fun computeReturnTypeRef(declaration: FirCallableDeclaration): FirResolvedTypeRef {
|
||||
(declaration.returnTypeRef as? FirResolvedTypeRef)?.let { return it }
|
||||
// To properly transform and resolve declaration's type, we need to use its module's session
|
||||
val session = declaration.moduleData.session
|
||||
val symbol = declaration.symbol
|
||||
require(!symbol.isSubstitutionOrIntersectionOverride) {
|
||||
"fakeOverrideSubstitution was not calculated for substitution or intersection override: $symbol with ${declaration.returnTypeRef}"
|
||||
}
|
||||
|
||||
val (designation, outerBodyResolveContext) = if (declaration in designationMapForLocalClasses) {
|
||||
designationMapForLocalClasses.getValue(declaration) to outerBodyResolveContext
|
||||
|
||||
+12
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.annotations.Abstra
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.annotations.AbstractAnalysisApiAnnotationsOnDeclarationsWithMetaTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.annotations.AbstractAnalysisApiAnnotationsOnFilesTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.annotations.AbstractAnalysisApiAnnotationsOnTypesTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.callResolver.AbstractMultiModuleResolveCallTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.callResolver.AbstractResolveCallTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.callResolver.AbstractResolveCandidatesTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.compileTimeConstantProvider.AbstractCompileTimeConstantEvaluatorTest
|
||||
@@ -205,6 +206,17 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
||||
}
|
||||
}
|
||||
|
||||
component("multiModuleCallResolver", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||
test(AbstractMultiModuleResolveCallTest::class, filter = frontendIs(FrontendKind.Fir)) {
|
||||
when (it.analysisApiMode) {
|
||||
AnalysisApiMode.Ide ->
|
||||
model("resolveCall")
|
||||
AnalysisApiMode.Standalone ->
|
||||
model("resolveCall")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component("compileTimeConstantProvider") {
|
||||
test(AbstractCompileTimeConstantEvaluatorTest::class) {
|
||||
model("evaluate")
|
||||
|
||||
Reference in New Issue
Block a user