[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:
+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 {
|
||||
|
||||
Reference in New Issue
Block a user