diff --git a/gradle.properties b/gradle.properties index 5847eead..595e1afe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ assertj_version = 3.21.0 junit_version = 5.8.2 # Version of published artifacts -version = 7.8.96 +version = 7.8.97 diff --git a/language/src/main/java/de/monticore/lang/sysmlv2/_symboltable/ISysMLv2Scope.java b/language/src/main/java/de/monticore/lang/sysmlv2/_symboltable/ISysMLv2Scope.java index 771a8fdb..fe5527be 100644 --- a/language/src/main/java/de/monticore/lang/sysmlv2/_symboltable/ISysMLv2Scope.java +++ b/language/src/main/java/de/monticore/lang/sysmlv2/_symboltable/ISysMLv2Scope.java @@ -298,6 +298,43 @@ default List resolvePortUsageLocallyMany( return new ArrayList<>(inherited); } + @Override + default List resolvePartUsageLocallyMany( + boolean foundSymbols, + String name, + AccessModifier modifier, + Predicate predicate + ) { + var resolved = + ISysMLv2ScopeTOP.super.resolvePartUsageLocallyMany( + foundSymbols, + name, + modifier, + predicate + ); + + if (!resolved.isEmpty() + || !isPresentSpanningSymbol() + || !(getSpanningSymbol() instanceof PartDefSymbol) + || !getSpanningSymbol().isPresentAstNode()) { + return resolved; + } + + var inherited = ((PartDefSymbol) getSpanningSymbol()).getAstNode() + .getSpecializationList().stream() + .filter(s -> s instanceof ASTSysMLSpecialization) + .flatMap(s -> s.getSuperTypesList().stream()) + .map(s -> s.getDefiningSymbol()) + .filter(s -> s.isPresent()) + .map(s -> s.get()) + .filter(s -> s instanceof PartDef2TypeSymbolAdapter) + .map(s -> (ISysMLv2Scope)((PartDef2TypeSymbolAdapter) s).getSpannedScope()) + .flatMap(scope -> scope.resolvePartUsageLocallyMany(false, name, modifier, predicate).stream()) + .collect(Collectors.toCollection(LinkedHashSet::new)); + + return new ArrayList<>(inherited); + } + @Override default List resolveAdaptedRequirementLocallyMany( boolean foundSymbols, diff --git a/language/src/test/java/cocos/InheritedConnectionResolutionTest.java b/language/src/test/java/cocos/InheritedConnectionResolutionTest.java index c2750ef5..67ae5da5 100644 --- a/language/src/test/java/cocos/InheritedConnectionResolutionTest.java +++ b/language/src/test/java/cocos/InheritedConnectionResolutionTest.java @@ -19,7 +19,6 @@ public class InheritedConnectionResolutionTest { - @Disabled("resolvePartUsageLocallyMany not overridden yet") @Test public void testAA3InheritedSubPartUsage() throws IOException { LogStub.init();