Skip to content

Commit fe9af7e

Browse files
committed
Fix refinement of a union type with a union type
1 parent 75ac205 commit fe9af7e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

usvm-dataflow-ts/src/main/kotlin/org/usvm/dataflow/ts/infer/TypeInferenceManager.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,11 +671,10 @@ class TypeInferenceManager(
671671
is EtsTypeFact.ObjectEtsTypeFact -> {
672672
val propertyAccessor = property.firstOrNull()
673673
if (propertyAccessor == null) {
674-
// TODO: handle 'type=union' by exploding it into multiple ObjectFacts (later combined with union) with class names from union.
675674
if (type is EtsTypeFact.UnionEtsTypeFact) {
676-
return type.types.map {
677-
refineProperty(property, it) ?: return null
678-
}.reduce { acc: EtsTypeFact, t: EtsTypeFact -> acc.union(t) }
675+
type.types.mapNotNull {
676+
refineProperty(property, it)
677+
}.reduceOrNull { acc: EtsTypeFact, t: EtsTypeFact -> acc.union(t) }
679678
}
680679

681680
if (type is EtsTypeFact.StringEtsTypeFact) {

0 commit comments

Comments
 (0)