File tree 2 files changed +10
-9
lines changed
fir/providers/src/org/jetbrains/kotlin/fir/resolve
testData/diagnostics/tests/typealias 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -136,18 +136,19 @@ private fun mapTypeAliasArguments(
136
136
137
137
override fun substituteArgument (projection : ConeTypeProjection , index : Int ): ConeTypeProjection ? {
138
138
val type = (projection as ? ConeKotlinTypeProjection )?.type ? : return null
139
- val symbol = (type as ? ConeTypeParameterType )?.lookupTag?.symbol ? : return super .substituteArgument(
140
- projection,
141
- index
142
- )
139
+ // TODO: Consider making code more generic and "ready" to any kind of types (KT-68497)
140
+ val symbol =
141
+ (type.unwrapFlexibleAndDefinitelyNotNull() as ? ConeTypeParameterType )?.lookupTag?.symbol
142
+ ? : return super .substituteArgument(projection, index )
143
143
val mappedProjection = typeAliasMap[symbol] ? : return super .substituteArgument(projection, index)
144
144
var mappedType = (mappedProjection as ? ConeKotlinTypeProjection )?.type.updateNullabilityIfNeeded(type)
145
145
mappedType = when (mappedType) {
146
146
is ConeErrorType ,
147
147
is ConeClassLikeTypeImpl ,
148
148
is ConeDefinitelyNotNullType ,
149
149
is ConeTypeParameterTypeImpl ,
150
- is ConeFlexibleType -> {
150
+ is ConeFlexibleType ,
151
+ -> {
151
152
mappedType.withAttributes(type.attributes.add(mappedType.attributes))
152
153
}
153
154
null -> return mappedProjection
Original file line number Diff line number Diff line change @@ -6,16 +6,16 @@ interface Inv2<K, V> {
6
6
typealias Inv1 <T > = Inv2 <String , T & Any >
7
7
8
8
fun test1 (inv : Inv1 <String >) {
9
- expectMap(< ! ARGUMENT_TYPE_MISMATCH ! > inv < ! > )
9
+ expectMap(inv )
10
10
val x = inv .get(" " )
11
- x.< ! UNRESOLVED_REFERENCE ! > length< ! >
11
+ x.length
12
12
}
13
13
14
14
fun test2 (map : Inv1 <String ?>) {
15
15
// Well, this K1 behavior doesn't look really correct, but we're not going to change it anymore
16
- expectMap(< ! ARGUMENT_TYPE_MISMATCH ! > map< ! > )
16
+ expectMap(map)
17
17
val x = map.get(" " )
18
- x.< ! UNRESOLVED_REFERENCE ! > length< ! >
18
+ x.length
19
19
}
20
20
21
21
fun expectMap (x : Inv2 <String , String >) {}
You can’t perform that action at this time.
0 commit comments