FIR: Fix INFERENCE_NO_INFORMATION_FOR_PARAMETER on type alias with generic expansion
^KT-46996 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
d76db0e011
commit
5ade831665
+3
-5
@@ -178,7 +178,9 @@ private fun processConstructors(
|
|||||||
|
|
||||||
val outerType = bodyResolveComponents.outerClassManager.outerType(type)
|
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(
|
TypeAliasConstructorsSubstitutingScope(
|
||||||
matchedSymbol,
|
matchedSymbol,
|
||||||
basicScope,
|
basicScope,
|
||||||
@@ -213,10 +215,6 @@ private class TypeAliasConstructorsSubstitutingScope(
|
|||||||
private val outerType: ConeClassLikeType?,
|
private val outerType: ConeClassLikeType?,
|
||||||
) : FirScope() {
|
) : FirScope() {
|
||||||
|
|
||||||
init {
|
|
||||||
require(outerType != null || typeAliasSymbol.fir.typeParameters.isNotEmpty())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
||||||
delegatingScope.processDeclaredConstructors wrapper@{ originalConstructorSymbol ->
|
delegatingScope.processDeclaredConstructors wrapper@{ originalConstructorSymbol ->
|
||||||
val typeParameters = typeAliasSymbol.fir.typeParameters
|
val typeParameters = typeAliasSymbol.fir.typeParameters
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// See KT-46996
|
|
||||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||||
// WASM_MUTE_REASON: UNIT_ISSUES
|
// WASM_MUTE_REASON: UNIT_ISSUES
|
||||||
typealias ArrayS = Array<String>
|
typealias ArrayS = Array<String>
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// See KT-46996
|
|
||||||
typealias BoolArray = Array<Boolean>
|
typealias BoolArray = Array<Boolean>
|
||||||
typealias IArray = IntArray
|
typealias IArray = IntArray
|
||||||
typealias MyArray<T> = Array<T>
|
typealias MyArray<T> = Array<T>
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ class Test1 : DeprecatedClassAlias()
|
|||||||
|
|
||||||
class Test2 : WithDeprecatedCtorAlias()
|
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 msn: MyString? = null
|
||||||
|
|
||||||
val msc: MyStringContainer = Container(ms)
|
val msc: MyStringContainer = Container(ms)
|
||||||
val msc1 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>MyStringContainer<!>(null)
|
val msc1 = MyStringContainer(null)
|
||||||
|
|||||||
+3
-3
@@ -7,8 +7,8 @@ typealias CIn = C<in Int>
|
|||||||
typealias COut = C<out Int>
|
typealias COut = C<out Int>
|
||||||
typealias CT<T> = C<T>
|
typealias CT<T> = C<T>
|
||||||
|
|
||||||
val test1 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>CStar<!>()
|
val test1 = CStar()
|
||||||
val test2 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>CIn<!>()
|
val test2 = CIn()
|
||||||
val test3 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>COut<!>()
|
val test3 = COut()
|
||||||
val test4 = CT<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>()
|
val test4 = CT<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>()
|
||||||
val test5 = CT<CT<*>>()
|
val test5 = CT<CT<*>>()
|
||||||
|
|||||||
+2
-2
@@ -8,10 +8,10 @@ typealias PIntIntA = Pair<Int, Int>
|
|||||||
typealias PA<T1A, T2A> = Pair<T1A, T2A>
|
typealias PA<T1A, T2A> = Pair<T1A, T2A>
|
||||||
typealias P2A<TA> = Pair<TA, TA>
|
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 test2 = CA<Int>(10)
|
||||||
val test3 = CA(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 test5 = PA<Int, Int>(10, 20)
|
||||||
val test6 = PA(10, 20)
|
val test6 = PA(10, 20)
|
||||||
val test7 = P2A<Int>(10, 20)
|
val test7 = P2A<Int>(10, 20)
|
||||||
|
|||||||
+1
-1
@@ -13,5 +13,5 @@ class Cell<T : Any?> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun test(): Cell<Int> {
|
fun test(): Cell<Int> {
|
||||||
return Cell<Any?>(value = 42)
|
return Cell</* null */>(value = 42)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -36,5 +36,5 @@ FILE fqName:<root> fileName:/specializedTypeAliasConstructorCall.kt
|
|||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun test (): <root>.Cell<kotlin.Int> declared in <root>'
|
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
|
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
|
value: CONST Int type=kotlin.Int value=42
|
||||||
|
|||||||
-3
@@ -1,6 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: ANY
|
|
||||||
// See KT-46996
|
|
||||||
|
|
||||||
class Cell<T>(val value: T)
|
class Cell<T>(val value: T)
|
||||||
|
|
||||||
typealias IntAlias = Cell<Int>
|
typealias IntAlias = Cell<Int>
|
||||||
|
|||||||
Reference in New Issue
Block a user