Skip to content

Commit

Permalink
Constraint and DefaultValue should not be ModelElements
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredebelen committed Jan 13, 2025
1 parent ecf2c6d commit 1579c46
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2562,7 +2562,7 @@ private Constraint constraint(CoreInstance owner, ConstraintContext ctx, int pos
Instance.setValueForProperty(constraintFunctionLambda, M3Properties.classifierGenericType, lambdaGenericType, this.processorSupport);
Instance.setValueForProperty(functionType, M3Properties.function, constraintFunctionLambda, this.processorSupport);

Constraint constraint = ConstraintInstance.createPersistent(this.repository, null, null, null);
Constraint constraint = ConstraintInstance.createPersistent(this.repository, null, null);
constraint.setSourceInformation(constraintSourceInformation);
constraint._name(constraintName);
if (constraintOwner != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@

^Root.children[meta].children[pure].children[metamodel].children[type].children[Class] InferredGenericType @Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children
{
Root.children[meta].children[pure].children[metamodel].children[extension].children[ElementWithStereotypes].properties[stereotypes] : Root.children[meta].children[pure].children[metamodel].children[ProtocolInfo].p_stereotypes[excluded],
Root.children[meta].children[pure].children[metamodel].children[type].children[Any].properties[classifierGenericType] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[type].children[Class], Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[typeArguments]:[^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[InferredGenericType]}]},
Root.children[meta].children[pure].children[metamodel].children[PackageableElement].properties[package] : Root.children[meta].children[pure].children[metamodel].children[type].children[generics],
Root.children[meta].children[pure].children[metamodel].children[ModelElement].properties[name] : 'InferredGenericType',
Expand Down Expand Up @@ -519,6 +520,7 @@

^Root.children[meta].children[pure].children[metamodel].children[type].children[Class] Referenceable @Root.children[meta].children[pure].children[metamodel].children
{
Root.children[meta].children[pure].children[metamodel].children[extension].children[ElementWithStereotypes].properties[stereotypes] : Root.children[meta].children[pure].children[metamodel].children[ProtocolInfo].p_stereotypes[excluded],
Root.children[meta].children[pure].children[metamodel].children[type].children[Any].properties[classifierGenericType] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[type].children[Class], Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[typeArguments]:[^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[Referenceable]}]},
Root.children[meta].children[pure].children[metamodel].children[PackageableElement].properties[package] : Root.children[meta].children[pure].children[metamodel],
Root.children[meta].children[pure].children[metamodel].children[ModelElement].properties[name] : 'Referenceable',
Expand Down Expand Up @@ -1084,6 +1086,7 @@

^Root.children[meta].children[pure].children[metamodel].children[type].children[Class] Any @Root.children[meta].children[pure].children[metamodel].children[type].children
{
Root.children[meta].children[pure].children[metamodel].children[extension].children[ElementWithStereotypes].properties[stereotypes] : Root.children[meta].children[pure].children[metamodel].children[ProtocolInfo].p_stereotypes[excluded],
Root.children[meta].children[pure].children[metamodel].children[type].children[Any].properties[classifierGenericType] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[type].children[Class], Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[typeArguments]:[^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[type].children[Any]}]},
Root.children[meta].children[pure].children[metamodel].children[PackageableElement].properties[package] : Root.children[meta].children[pure].children[metamodel].children[type],
Root.children[meta].children[pure].children[metamodel].children[ModelElement].properties[name] : 'Any',
Expand Down Expand Up @@ -1719,6 +1722,7 @@

^Root.children[meta].children[pure].children[metamodel].children[type].children[Class] NonExecutableValueSpecification @Root.children[meta].children[pure].children[metamodel].children[valuespecification].children
{
Root.children[meta].children[pure].children[metamodel].children[extension].children[ElementWithStereotypes].properties[stereotypes] : Root.children[meta].children[pure].children[metamodel].children[ProtocolInfo].p_stereotypes[excluded],
Root.children[meta].children[pure].children[metamodel].children[type].children[Any].properties[classifierGenericType] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[type].children[Class], Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[typeArguments]:^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[valuespecification].children[NonExecutableValueSpecification]}},
Root.children[meta].children[pure].children[metamodel].children[PackageableElement].properties[package] : Root.children[meta].children[pure].children[metamodel].children[valuespecification],
Root.children[meta].children[pure].children[metamodel].children[type].children[Class].properties[properties]:
Expand Down Expand Up @@ -3130,6 +3134,14 @@
Root.children[meta].children[pure].children[metamodel].children[PackageableElement].properties[package] : Root.children[meta].children[pure].children[metamodel].children[constraint],
Root.children[meta].children[pure].children[metamodel].children[type].children[Class].properties[properties]:
[
^Root.children[meta].children[pure].children[metamodel].children[function].children[property].children[Property] name
{
Root.children[meta].children[pure].children[metamodel].children[ModelElement].properties[name] : 'name',
Root.children[meta].children[pure].children[metamodel].children[function].children[property].children[Property].properties[aggregation] : Root.children[meta].children[pure].children[metamodel].children[function].children[property].children[AggregationKind].values[None],
Root.children[meta].children[pure].children[metamodel].children[function].children[property].children[AbstractProperty].properties[genericType] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:String},
Root.children[meta].children[pure].children[metamodel].children[function].children[property].children[AbstractProperty].properties[multiplicity] : Root.children[meta].children[pure].children[metamodel].children[multiplicity].children[PureOne],
Root.children[meta].children[pure].children[metamodel].children[type].children[Any].properties[classifierGenericType] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[function].children[property].children[Property], Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[typeArguments]:[^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:Root.children[meta].children[pure].children[metamodel].children[constraint].children[Constraint]}, ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType]{Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType]:String}], Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[multiplicityArguments]:Root.children[meta].children[pure].children[metamodel].children[multiplicity].children[PureOne]}
},
^Root.children[meta].children[pure].children[metamodel].children[function].children[property].children[Property] owner
{
Root.children[meta].children[pure].children[metamodel].children[ModelElement].properties[name] : 'owner',
Expand Down Expand Up @@ -3176,7 +3188,7 @@
[
^Root.children[meta].children[pure].children[metamodel].children[relationship].children[Generalization]
{
Root.children[meta].children[pure].children[metamodel].children[relationship].children[Generalization].properties[general] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType] {Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType] : Root.children[meta].children[pure].children[metamodel].children[ModelElement]},
Root.children[meta].children[pure].children[metamodel].children[relationship].children[Generalization].properties[general] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType] {Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType] : Root.children[meta].children[pure].children[metamodel].children[type].children[Any]},
Root.children[meta].children[pure].children[metamodel].children[relationship].children[Generalization].properties[specific] : Root.children[meta].children[pure].children[metamodel].children[constraint].children[Constraint]
}
]
Expand Down Expand Up @@ -3234,7 +3246,7 @@
[
^Root.children[meta].children[pure].children[metamodel].children[relationship].children[Generalization]
{
Root.children[meta].children[pure].children[metamodel].children[relationship].children[Generalization].properties[general] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType] {Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType] : Root.children[meta].children[pure].children[metamodel].children[ModelElement]},
Root.children[meta].children[pure].children[metamodel].children[relationship].children[Generalization].properties[general] : ^Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType] {Root.children[meta].children[pure].children[metamodel].children[type].children[generics].children[GenericType].properties[rawType] : Root.children[meta].children[pure].children[metamodel].children[type].children[Any]},
Root.children[meta].children[pure].children[metamodel].children[relationship].children[Generalization].properties[specific] : Root.children[meta].children[pure].children[metamodel].children[function].children[property].children[DefaultValue]
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void testLineInfoForDynamicInstanceGeneratedM3()
CoreInstance classifierGenericType = propertiesByName.get("classifierGenericType");
Assert.assertNotNull(classifierGenericType);
// Note: these source coordinates may change if m3.pure changes
assertSourceInformation("/platform/pure/grammar/m3.pure", 1092, 13, 1092, 126, 1099, 17, classifierGenericType.getSourceInformation());
assertSourceInformation("/platform/pure/grammar/m3.pure", 1096, 13, 1096, 126, 1103, 17, classifierGenericType.getSourceInformation());

// Test function
CoreInstance func = runtime.getCoreInstance("pkg1::pkg2::printSomething__Any_1_");
Expand All @@ -136,7 +136,7 @@ public void testLineInfoForDynamicInstanceGeneratedM3()
Assert.assertNotNull(funcType);
Assert.assertEquals(M3Paths.ConcreteFunctionDefinition, PackageableElement.getUserPathForPackageableElement(funcType, "::"));
// Note: these source coordinates may change if m3.pure changes
assertSourceInformation("/platform/pure/grammar/m3.pure", 2350, 1, 2350, 88, 2374, 1, funcType.getSourceInformation());
assertSourceInformation("/platform/pure/grammar/m3.pure", 2355, 1, 2355, 88, 2379, 1, funcType.getSourceInformation());
}

@Test
Expand Down

0 comments on commit 1579c46

Please sign in to comment.