Put not-null original type as last possible smart cast target
This fixes muted tests testSmartCast (IDE highlighting) and
testNestedSealed (Diagnostics).
Together with commit 555b3f12 this makes #KT-15901 Fixed
This commit is contained in:
@@ -46,6 +46,7 @@ interface DataFlowInfo {
|
||||
*
|
||||
* IMPORTANT: by default, the original (native) type for this value
|
||||
* are NOT included. So it's quite possible to get an empty set here.
|
||||
* Also, type order in the result set MAKES SENSE so keep it stable and do not change without reason
|
||||
*/
|
||||
fun getCollectedTypes(key: DataFlowValue): Set<KotlinType>
|
||||
|
||||
@@ -55,6 +56,7 @@ interface DataFlowInfo {
|
||||
*
|
||||
* IMPORTANT: by default, the original (native) type for this value
|
||||
* are NOT included. So it's quite possible to get an empty set here.
|
||||
* Also, type order in the result set MAKES SENSE so keep it stable and do not change without reason
|
||||
*/
|
||||
fun getStableTypes(key: DataFlowValue): Set<KotlinType>
|
||||
|
||||
|
||||
+3
-3
@@ -122,12 +122,12 @@ internal class DelegatingDataFlowInfo private constructor(
|
||||
|
||||
val enrichedTypes = newLinkedHashSetWithExpectedSize<KotlinType>(types.size + 1)
|
||||
val originalType = key.type
|
||||
if (originalType.isMarkedNullable) {
|
||||
enrichedTypes.add(TypeUtils.makeNotNullable(originalType))
|
||||
}
|
||||
for (type in types) {
|
||||
enrichedTypes.add(TypeUtils.makeNotNullable(type))
|
||||
}
|
||||
if (originalType.isMarkedNullable) {
|
||||
enrichedTypes.add(TypeUtils.makeNotNullable(originalType))
|
||||
}
|
||||
|
||||
return enrichedTypes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user