FIR: Fix INFERENCE_NO_INFORMATION_FOR_PARAMETER on type alias with generic expansion

^KT-46996 Fixed
This commit is contained in:
Denis.Zharkov
2021-05-27 18:41:36 +03:00
committed by TeamCityServer
parent d76db0e011
commit 5ade831665
10 changed files with 12 additions and 21 deletions
@@ -178,7 +178,9 @@ private fun processConstructors(
val outerType = bodyResolveComponents.outerClassManager.outerType(type)
if (basicScope != null && (matchedSymbol.fir.typeParameters.isNotEmpty() || outerType != null)) {
if (basicScope != null &&
(matchedSymbol.fir.typeParameters.isNotEmpty() || outerType != null || type.typeArguments.isNotEmpty())
) {
TypeAliasConstructorsSubstitutingScope(
matchedSymbol,
basicScope,
@@ -213,10 +215,6 @@ private class TypeAliasConstructorsSubstitutingScope(
private val outerType: ConeClassLikeType?,
) : FirScope() {
init {
require(outerType != null || typeAliasSymbol.fir.typeParameters.isNotEmpty())
}
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
delegatingScope.processDeclaredConstructors wrapper@{ originalConstructorSymbol ->
val typeParameters = typeAliasSymbol.fir.typeParameters
@@ -1,5 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// See KT-46996
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNIT_ISSUES
typealias ArrayS = Array<String>
@@ -1,5 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// See KT-46996
typealias BoolArray = Array<Boolean>
typealias IArray = IntArray
typealias MyArray<T> = Array<T>
@@ -14,4 +14,4 @@ class Test1 : DeprecatedClassAlias()
class Test2 : WithDeprecatedCtorAlias()
val test3 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>ArrayListOfDeprecatedClass<!>()
val test3 = ArrayListOfDeprecatedClass()
@@ -10,4 +10,4 @@ val ms: MyString = "MyString"
val msn: MyString? = null
val msc: MyStringContainer = Container(ms)
val msc1 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>MyStringContainer<!>(null)
val msc1 = MyStringContainer(null)
@@ -7,8 +7,8 @@ typealias CIn = C<in Int>
typealias COut = C<out Int>
typealias CT<T> = C<T>
val test1 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>CStar<!>()
val test2 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>CIn<!>()
val test3 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>COut<!>()
val test1 = CStar()
val test2 = CIn()
val test3 = COut()
val test4 = CT<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>()
val test5 = CT<CT<*>>()
@@ -8,10 +8,10 @@ typealias PIntIntA = Pair<Int, Int>
typealias PA<T1A, T2A> = Pair<T1A, T2A>
typealias P2A<TA> = Pair<TA, TA>
val test1 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>CIntA<!>(10)
val test1 = CIntA(10)
val test2 = CA<Int>(10)
val test3 = CA(10)
val test4 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>PIntIntA<!>(10, 20)
val test4 = PIntIntA(10, 20)
val test5 = PA<Int, Int>(10, 20)
val test6 = PA(10, 20)
val test7 = P2A<Int>(10, 20)
@@ -13,5 +13,5 @@ class Cell<T : Any?> {
}
fun test(): Cell<Int> {
return Cell<Any?>(value = 42)
return Cell</* null */>(value = 42)
}
@@ -36,5 +36,5 @@ FILE fqName:<root> fileName:/specializedTypeAliasConstructorCall.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (): <root>.Cell<kotlin.Int> declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (value: T of <root>.Cell) [primary] declared in <root>.Cell' type=<root>.Cell<kotlin.Int> origin=null
<class: T>: kotlin.Any?
<class: T>: <none>
value: CONST Int type=kotlin.Int value=42
@@ -1,6 +1,3 @@
// IGNORE_BACKEND_FIR: ANY
// See KT-46996
class Cell<T>(val value: T)
typealias IntAlias = Cell<Int>