[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:
Anna Kozlova
2023-01-26 20:19:38 +01:00
committed by teamcity
parent f3cbc1b2d4
commit b415aa7446
28 changed files with 776 additions and 0 deletions
@@ -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
@@ -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 = {}
@@ -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
@@ -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 = {}