Skip to content

Commit 61e5b31

Browse files
committed
Fix determining if there is property conflict
1 parent ed9d3c0 commit 61e5b31

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

model-lowerings-common/src/org/jetbrains/dukat/model/commonLowerings/overrides/VarConflictResolveLowering.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,18 @@ private class VarOverrideResolver(
4242
): List<List<MemberData>> {
4343
return parentMembers.keys.mapNotNull { name ->
4444
val properties = parentMembers[name].orEmpty().filter { it.memberModel is PropertyModel }
45-
if (properties.isEmpty() || cartesian(properties, properties).all { (first, second) ->
45+
46+
val propertiesInImmediateParents = properties.filter { first ->
47+
properties.none { second ->
48+
inheritanceContext.isDescendant(second.ownerModel, first.ownerModel)
49+
}
50+
}
51+
52+
// if all properties in immediate parents have equivalent type, then there is no conflict
53+
if (propertiesInImmediateParents.isEmpty() || propertiesInImmediateParents.all { property ->
4654
with(typeChecker) {
47-
(first.memberModel as PropertyModel).type.isEquivalent((second.memberModel as PropertyModel).type)
48-
} || inheritanceContext.areRelated(first.ownerModel, second.ownerModel)
55+
(property.memberModel as PropertyModel).type.isEquivalent((properties[0].memberModel as PropertyModel).type)
56+
}
4957
}) {
5058
null
5159
} else {

0 commit comments

Comments
 (0)