From 5f976cfdb681b846fc5fa3118c740b7760aae44e Mon Sep 17 00:00:00 2001 From: MKZaito <127297267+MKZaito@users.noreply.github.com> Date: Mon, 31 Aug 2026 13:58:11 +0200 Subject: [PATCH 1/4] SysMLBuiltInTypeRelations --- .../types3/SysMLBuiltInTypeRelations.java | 33 +++++++++++++++++++ .../sysmlv2/types3/SysMLSymTypeRelations.java | 26 +-------------- 2 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLBuiltInTypeRelations.java diff --git a/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLBuiltInTypeRelations.java b/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLBuiltInTypeRelations.java new file mode 100644 index 00000000..19bba38c --- /dev/null +++ b/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLBuiltInTypeRelations.java @@ -0,0 +1,33 @@ +package de.monticore.lang.sysmlv2.types3; + +import de.monticore.types.check.SymTypeExpression; + + +public class SysMLBuiltInTypeRelations extends de.monticore.types3.util.BuiltInTypeRelations{ + + @Override + public boolean isIntegralType(SymTypeExpression type) { + return super.isIntegralType(type) || + isNat(type) || + checkFullName(type, "ScalarValues.Integer"); + } + + @Override + public boolean isBoolean(SymTypeExpression type) { + return super.isBoolean(type) || checkFullName(type, "ScalarValues.Boolean"); + } + + public boolean isNat(SymTypeExpression type) { + return ( + type.isPrimitive() && + type.asPrimitive().getPrimitiveName().equals("nat") + ) || + checkFullName(type, "ScalarValues.Natural") || + checkFullName(type, "ScalarValues.Positive"); + } + + private boolean checkFullName(SymTypeExpression type, String fullName) { + return type.hasTypeInfo() && + type.getTypeInfo().getFullName().equals(fullName); + } +} diff --git a/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLSymTypeRelations.java b/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLSymTypeRelations.java index 471b5923..bd288f90 100644 --- a/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLSymTypeRelations.java +++ b/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLSymTypeRelations.java @@ -1,9 +1,6 @@ package de.monticore.lang.sysmlv2.types3; import de.monticore.ocl.types3.OCLSymTypeRelations; -import de.monticore.types.check.SymTypeExpression; -import de.monticore.types3.util.BuiltInTypeRelations; -import de.monticore.types3.util.SymTypeCompatibilityCalculator; import de.monticore.types3.util.SymTypeRelationsDefaultDelegatee; public abstract class SysMLSymTypeRelations extends OCLSymTypeRelations { @@ -16,28 +13,7 @@ public static void init() { protected static class SysMLSymTypeRelationsDelegatee extends SymTypeRelationsDefaultDelegatee { public SysMLSymTypeRelationsDelegatee() { - builtInRelationsDelegate = new BuiltInTypeRelations() { - @Override - public boolean isIntegralType(SymTypeExpression type) { - return super.isIntegralType(type) || - type.isPrimitive() && - type.asPrimitive().getPrimitiveName().equals("nat"); - } - - /* - Any Type that is included here will be compatible with any other Type - in the list. - */ - @Override - public boolean isBoolean(SymTypeExpression type) { - return (super.isBoolean(type) || - ( - type.hasTypeInfo() && - type.getTypeInfo().getFullName().equals("ScalarValues.Boolean") - ) - ); - } - }; + builtInRelationsDelegate = new SysMLBuiltInTypeRelations(); } } } From 6cdb8415eb48f25a318f2d3ec37e300046be7c03 Mon Sep 17 00:00:00 2001 From: MKZaito <127297267+MKZaito@users.noreply.github.com> Date: Mon, 31 Aug 2026 14:24:26 +0200 Subject: [PATCH 2/4] CompareTypesTest adjust --- language/src/test/java/typecheck/CompareTypesTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/language/src/test/java/typecheck/CompareTypesTest.java b/language/src/test/java/typecheck/CompareTypesTest.java index 26365858..c5bcdbf7 100644 --- a/language/src/test/java/typecheck/CompareTypesTest.java +++ b/language/src/test/java/typecheck/CompareTypesTest.java @@ -57,7 +57,8 @@ public void clear() { @ParameterizedTest @ValueSource(strings = { - "attribute target : boolean; attribute source : ScalarValues::Boolean;" + "attribute target : boolean; attribute source : ScalarValues::Boolean;", + "attribute target : ScalarValues::Integer; attribute source : int;", }) public void test4CompatibleTypes(String targetAndSource) throws IOException { var type = typeOfConstraintExpression(targetAndSource); @@ -70,7 +71,7 @@ public void test4CompatibleTypes(String targetAndSource) throws IOException { // int und ScalarValues::Integer sollte erlaubt sein, aber das muss noch implementiert werden @ParameterizedTest @ValueSource(strings = { - "attribute target : int; attribute source : ScalarValues::Integer;" + "attribute target : int; attribute source : ScalarValues::String;" }) public void test4IncompatibleTypes(String targetAndSource) throws IOException { var type = typeOfConstraintExpression(targetAndSource); From fb0422ba64c3d6b2acac2dc0fc67553f19dc2596 Mon Sep 17 00:00:00 2001 From: MKZaito <127297267+MKZaito@users.noreply.github.com> Date: Mon, 31 Aug 2026 15:19:37 +0200 Subject: [PATCH 3/4] version bumb to 7.8.84 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 58936ebc..b0ecc25e 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.83 +version = 7.8.84 From 8325b4ef2dcd04b71ddaa6e8858cd8e458d5f8b2 Mon Sep 17 00:00:00 2001 From: MKZaito <127297267+MKZaito@users.noreply.github.com> Date: Mon, 31 Aug 2026 16:02:09 +0200 Subject: [PATCH 4/4] alles inlinen --- .../types3/SysMLBuiltInTypeRelations.java | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLBuiltInTypeRelations.java b/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLBuiltInTypeRelations.java index 19bba38c..8920d124 100644 --- a/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLBuiltInTypeRelations.java +++ b/language/src/main/java/de/monticore/lang/sysmlv2/types3/SysMLBuiltInTypeRelations.java @@ -2,32 +2,30 @@ import de.monticore.types.check.SymTypeExpression; - +/** + * Dient dazu die MontiCore Built-Ins (int, String, boolean, nat) mit den + * KerML-ScalarValues (Integer, String, Boolean, Natural/Positive) kompatibel + * zu machen. + */ public class SysMLBuiltInTypeRelations extends de.monticore.types3.util.BuiltInTypeRelations{ @Override public boolean isIntegralType(SymTypeExpression type) { - return super.isIntegralType(type) || - isNat(type) || - checkFullName(type, "ScalarValues.Integer"); + return super.isIntegralType(type) + || (type.isPrimitive() + && type.asPrimitive().getPrimitiveName().equals("nat")) + || (type.hasTypeInfo() + && ( + type.getTypeInfo().getFullName().equals("ScalarValues.Integer") || + type.getTypeInfo().getFullName().equals("ScalarValues.Natural") || + type.getTypeInfo().getFullName().equals("ScalarValues.Positive")) + ); } @Override public boolean isBoolean(SymTypeExpression type) { - return super.isBoolean(type) || checkFullName(type, "ScalarValues.Boolean"); - } - - public boolean isNat(SymTypeExpression type) { - return ( - type.isPrimitive() && - type.asPrimitive().getPrimitiveName().equals("nat") - ) || - checkFullName(type, "ScalarValues.Natural") || - checkFullName(type, "ScalarValues.Positive"); - } - - private boolean checkFullName(SymTypeExpression type, String fullName) { - return type.hasTypeInfo() && - type.getTypeInfo().getFullName().equals(fullName); + return super.isBoolean(type) || + (type.hasTypeInfo() && + type.getTypeInfo().getFullName().equals("ScalarValues.Boolean")); } }