diff --git a/src/main/java/de/monticore/ocl/types3/OCLCollectionSymTypeRelations.java b/src/main/java/de/monticore/ocl/types3/OCLCollectionSymTypeRelations.java index b7dd4f75..b5cd218d 100644 --- a/src/main/java/de/monticore/ocl/types3/OCLCollectionSymTypeRelations.java +++ b/src/main/java/de/monticore/ocl/types3/OCLCollectionSymTypeRelations.java @@ -56,7 +56,7 @@ protected SymTypeOfGenerics _flatten(SymTypeOfGenerics toFlatten) { // if we cannot flatten, this is id else { Log.info( - "called flatten on type " + toFlatten.printFullName() + " which cannot be flattenend", + "called flatten on type " + toFlatten.printFullName() + " which cannot be flattened", LOG_NAME); flattened = toFlatten; } diff --git a/src/test/resources/testinput/CDs/AuctionCD.cd b/src/test/resources/testinput/CDs/AuctionCD.cd index 11d9128e..eda20fc6 100644 --- a/src/test/resources/testinput/CDs/AuctionCD.cd +++ b/src/test/resources/testinput/CDs/AuctionCD.cd @@ -72,5 +72,6 @@ classdiagram AuctionCD { association Person (bidder) <-> Message [*] <>; association Auction <-> Message [*] <>; association Auction -> Policy [1]; + association Company -> (hiwis) Student [*] <>; } diff --git a/src/test/resources/testinput/CDs/AuctionCD.sym b/src/test/resources/testinput/CDs/AuctionCD.sym index 4ddd1c31..87dc7e1b 100644 --- a/src/test/resources/testinput/CDs/AuctionCD.sym +++ b/src/test/resources/testinput/CDs/AuctionCD.sym @@ -5,7 +5,7 @@ { "kind":"de.monticore.cdassociation._symboltable.CDAssociationSymbol", "name":"participants", - "association":820878444 + "association":288615534 }, { "kind":"de.monticore.cdbasis._symboltable.CDTypeSymbol", @@ -118,7 +118,7 @@ "packageName":"AuctionCD", "isDefinitiveNavigable":true, "cardinality":"[*]", - "association":2113243119, + "association":1427775702, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", "objName":"AuctionCD.Person" @@ -221,13 +221,26 @@ "packageName":"AuctionCD", "isDefinitiveNavigable":true, "cardinality":"[*]", - "association":1972326147, + "association":669053685, "isLeft":true, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", "objName":"AuctionCD.Person" } }, + { + "kind":"de.monticore.cdassociation._symboltable.CDRoleSymbol", + "name":"hiwis", + "fullName":"AuctionCD.Company.hiwis", + "packageName":"AuctionCD", + "isDefinitiveNavigable":true, + "cardinality":"[*]", + "association":896852376, + "type":{ + "kind":"de.monticore.types.check.SymTypeOfObject", + "objName":"AuctionCD.Student" + } + }, { "kind":"de.monticore.symbols.oosymbols._symboltable.FieldSymbol", "name":"name", @@ -253,6 +266,22 @@ } ] } + }, + { + "kind":"de.monticore.symbols.oosymbols._symboltable.FieldSymbol", + "name":"hiwis", + "fullName":"AuctionCD.Company.hiwis", + "packageName":"AuctionCD", + "type":{ + "kind":"de.monticore.types.check.SymTypeOfGenerics", + "typeConstructorFullName":"java.util.Set", + "arguments":[ + { + "kind":"de.monticore.types.check.SymTypeOfObject", + "objName":"AuctionCD.Student" + } + ] + } } ] } @@ -285,7 +314,7 @@ "packageName":"AuctionCD", "isDefinitiveNavigable":true, "cardinality":"[*]", - "association":820878444, + "association":288615534, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", "objName":"AuctionCD.Person" @@ -298,7 +327,7 @@ "packageName":"AuctionCD", "isDefinitiveNavigable":true, "cardinality":"[*]", - "association":1764291958, + "association":229919394, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", "objName":"AuctionCD.Message" @@ -311,7 +340,7 @@ "packageName":"AuctionCD", "isDefinitiveNavigable":true, "cardinality":"[1]", - "association":1712230656, + "association":769877691, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", "objName":"AuctionCD.Policy" @@ -533,7 +562,7 @@ "fullName":"AuctionCD.Message.bidder", "packageName":"AuctionCD", "isDefinitiveNavigable":true, - "association":896852376, + "association":1324262781, "isLeft":true, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", @@ -546,7 +575,7 @@ "fullName":"AuctionCD.Message.auction", "packageName":"AuctionCD", "isDefinitiveNavigable":true, - "association":1764291958, + "association":229919394, "isLeft":true, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", @@ -612,22 +641,12 @@ "name":"auction", "fullName":"AuctionCD.Policy.auction", "packageName":"AuctionCD", - "association":1712230656, + "association":769877691, "isLeft":true, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", "objName":"AuctionCD.Auction" } - }, - { - "kind":"de.monticore.symbols.oosymbols._symboltable.FieldSymbol", - "name":"auction", - "fullName":"AuctionCD.Policy.auction", - "packageName":"AuctionCD", - "type":{ - "kind":"de.monticore.types.check.SymTypeOfObject", - "objName":"AuctionCD.Auction" - } } ] } @@ -692,7 +711,7 @@ "fullName":"AuctionCD.Person.allData", "packageName":"AuctionCD", "isDefinitiveNavigable":true, - "association":2113243119, + "association":1427775702, "isLeft":true, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", @@ -706,7 +725,7 @@ "packageName":"AuctionCD", "isDefinitiveNavigable":true, "cardinality":"[*]", - "association":820878444, + "association":288615534, "isLeft":true, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", @@ -720,7 +739,7 @@ "packageName":"AuctionCD", "isDefinitiveNavigable":true, "cardinality":"[1]", - "association":1972326147, + "association":669053685, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", "objName":"AuctionCD.Company" @@ -733,7 +752,7 @@ "packageName":"AuctionCD", "isDefinitiveNavigable":true, "cardinality":"[*]", - "association":896852376, + "association":1324262781, "type":{ "kind":"de.monticore.types.check.SymTypeOfObject", "objName":"AuctionCD.Message" @@ -838,6 +857,18 @@ "isConstructor":true, "isPublic":true, "isStatic":true + }, + { + "kind":"de.monticore.cdassociation._symboltable.CDRoleSymbol", + "name":"company", + "fullName":"AuctionCD.Student.company", + "packageName":"AuctionCD", + "association":896852376, + "isLeft":true, + "type":{ + "kind":"de.monticore.types.check.SymTypeOfObject", + "objName":"AuctionCD.Company" + } } ] } @@ -936,27 +967,31 @@ } ], "furtherObjects":{ - "820878444":{ + "1324262781":{ "kind":"de.monticore.cdassociation._symboltable.SymAssociation", "isAssociation":true }, - "2113243119":{ + "669053685":{ "kind":"de.monticore.cdassociation._symboltable.SymAssociation", "isAssociation":true }, - "1972326147":{ + "229919394":{ "kind":"de.monticore.cdassociation._symboltable.SymAssociation", "isAssociation":true }, - "896852376":{ + "769877691":{ + "kind":"de.monticore.cdassociation._symboltable.SymAssociation", + "isAssociation":true + }, + "1427775702":{ "kind":"de.monticore.cdassociation._symboltable.SymAssociation", "isAssociation":true }, - "1764291958":{ + "896852376":{ "kind":"de.monticore.cdassociation._symboltable.SymAssociation", "isAssociation":true }, - "1712230656":{ + "288615534":{ "kind":"de.monticore.cdassociation._symboltable.SymAssociation", "isAssociation":true } diff --git a/src/test/resources/testinput/parsable/symtab/coco/not_javagen/flatteningWithSuperType.ocl b/src/test/resources/testinput/parsable/symtab/coco/not_javagen/flatteningWithSuperType.ocl new file mode 100644 index 00000000..2cb9aa25 --- /dev/null +++ b/src/test/resources/testinput/parsable/symtab/coco/not_javagen/flatteningWithSuperType.ocl @@ -0,0 +1,8 @@ +/* (c) https://github.com/MontiCore/monticore */ + +import example.CDs.AuctionCD.*; + +ocl flatteningWithSuperType { + context Company c inv: + true isin c.hiwis.isActive; +} \ No newline at end of file diff --git a/src/test/resources/testinput/parsable/symtab/invalid_coco/typeif2.ocl b/src/test/resources/testinput/parsable/symtab/invalid_coco/typeif2.ocl new file mode 100644 index 00000000..8d178ab1 --- /dev/null +++ b/src/test/resources/testinput/parsable/symtab/invalid_coco/typeif2.ocl @@ -0,0 +1,10 @@ +/* (c) https://github.com/MontiCore/monticore */ + +import example.CDs.AuctionCD.*; + +ocl typeif2 { + context Auction a inv: + typeif a instanceof Auction + then a.numberOfBids >= 0 + else a.numberOfBids >= 0; +} \ No newline at end of file diff --git a/src/test/resources/testinput/parsable/no_symtab/let2.ocl b/src/test/resources/testinput/parsable/symtab/let2.ocl similarity index 100% rename from src/test/resources/testinput/parsable/no_symtab/let2.ocl rename to src/test/resources/testinput/parsable/symtab/let2.ocl