diff --git a/XPlus.setup b/XPlus.setup index cf41b4c..c9e233f 100644 --- a/XPlus.setup +++ b/XPlus.setup @@ -383,8 +383,6 @@ url="https://download.eclipse.org/releases/2024-09"/> - [ + ['0a','0b','0c'], + ['1a','1b','1c'], + ['2a','2b','2c'] + ], + listOfStrings = null, + aString = null + } + Config out = Config { + listOfListOfStrings = null , + listOfStrings = < string [ ] > [ "0a" , "0b" , "0c" ] , + aString = "0a" + } + + string s = "0a" + string [ ] sArray = < string [ ] > [ "0a" , "0b" , "0c" ] + ''', ''' + record Config { + string[][] listOfListOfStrings + string[] listOfStrings + string aString + } + Config config = Config { + listOfListOfStrings = [ + ['0a','0b','0c'], + ['1a','1b','1c'], + ['2a','2b','2c'] + ], + listOfStrings = null, + aString = null + } + Config out = Config { + listOfListOfStrings = null, + listOfStrings = get(config.listOfListOfStrings, 0), // expected returned value: ['0a', '0b', '0c'] + aString = get(get(config.listOfListOfStrings, 0), 0) + } + string s = out.aString + string[] sArray = out.listOfStrings + ''') + + } + + } diff --git a/bundles/nl.esi.xtext.expressions.tests/src/nl/esi/xtext/expressions/tests/ExpressionValidationTest.xtend b/bundles/nl.esi.xtext.expressions.tests/src/nl/esi/xtext/expressions/tests/ExpressionValidationTest.xtend index 86397a1..3092ed5 100644 --- a/bundles/nl.esi.xtext.expressions.tests/src/nl/esi/xtext/expressions/tests/ExpressionValidationTest.xtend +++ b/bundles/nl.esi.xtext.expressions.tests/src/nl/esi/xtext/expressions/tests/ExpressionValidationTest.xtend @@ -209,6 +209,34 @@ class ExpressionValidationTest { int d = 2 ^ 3 ^ 2 ''') } + + @Test + def void testListOfLists(){ + validate(''' + record Config { + string[][] listOfListOfStrings + string[] listOfStrings + string aString + } + Config config = Config { + listOfListOfStrings = [ + ['0a','0b','0c'], + ['1a','1b','1c'], + ['2a','2b','2c'] + ], + listOfStrings = null, + aString = null + } + Config out = Config { + listOfListOfStrings = null, + listOfStrings = get(config.listOfListOfStrings, 0), // expected returned value: ['0a', '0b', '0c'] + aString = get(get(config.listOfListOfStrings, 0), 0) + } + + string s = out.aString + string[] s1 = out.listOfStrings + ''') + } private def validate(String text) { val result = parseHelper.parse(text) diff --git a/bundles/nl.esi.xtext.expressions/META-INF/MANIFEST.MF b/bundles/nl.esi.xtext.expressions/META-INF/MANIFEST.MF index 14ea210..7c811a4 100644 --- a/bundles/nl.esi.xtext.expressions/META-INF/MANIFEST.MF +++ b/bundles/nl.esi.xtext.expressions/META-INF/MANIFEST.MF @@ -3,6 +3,29 @@ Bundle-ManifestVersion: 2 Bundle-Name: Expression Lang Core Bundle-Vendor: TNO-ESI Bundle-Version: 0.4.0.qualifier +Export-Package: nl.esi.xtext.expressions, + nl.esi.xtext.expressions, + nl.esi.xtext.expressions.conversion, + nl.esi.xtext.expressions.evaluation, + nl.esi.xtext.expressions.evaluation, + nl.esi.xtext.expressions.expression, + nl.esi.xtext.expressions.expression.impl, + nl.esi.xtext.expressions.expression.util, + nl.esi.xtext.expressions.formatting2, + nl.esi.xtext.expressions.functions, + nl.esi.xtext.expressions.generator, + nl.esi.xtext.expressions.generator, + nl.esi.xtext.expressions.generator.plantuml, + nl.esi.xtext.expressions.parser.antlr, + nl.esi.xtext.expressions.parser.antlr.internal, + nl.esi.xtext.expressions.scoping, + nl.esi.xtext.expressions.scoping, + nl.esi.xtext.expressions.serializer, + nl.esi.xtext.expressions.services, + nl.esi.xtext.expressions.utilities, + nl.esi.xtext.expressions.utilities, + nl.esi.xtext.expressions.validation, + nl.esi.xtext.expressions.validation Bundle-SymbolicName: nl.esi.xtext.expressions; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: nl.esi.xtext.types;visibility:=reexport, @@ -17,63 +40,5 @@ Require-Bundle: nl.esi.xtext.types;visibility:=reexport, org.eclipse.emf.common, org.eclipse.core.runtime Bundle-RequiredExecutionEnvironment: JavaSE-21 -Export-Package: nl.esi.xtext.expressions, - nl.esi.xtext.expressions.conversion, - nl.esi.xtext.expressions.evaluation, - nl.esi.xtext.expressions.functions, - nl.esi.xtext.expressions.expression; - uses:="org.eclipse.emf.ecore, - org.eclipse.emf.common.util, - nl.esi.xtext.types.types", - nl.esi.xtext.expressions.expression.impl; - uses:="org.eclipse.emf.ecore, - org.eclipse.emf.ecore.impl, - org.eclipse.emf.common.util, - org.eclipse.emf.common.notify, - nl.esi.xtext.types.types, - nl.esi.xtext.types.types.impl, - nl.esi.xtext.expressions.expression", - nl.esi.xtext.expressions.expression.util; - uses:="org.eclipse.emf.ecore, - org.eclipse.emf.common.notify, - org.eclipse.emf.common.notify.impl, - org.eclipse.emf.ecore.util, - nl.esi.xtext.types.types, - nl.esi.xtext.expressions.expression", - nl.esi.xtext.expressions.formatting2;uses:="nl.esi.xtext.types.formatting2,org.eclipse.xtext.formatting2,nl.esi.xtext.expressions.expression", - nl.esi.xtext.expressions.generator; - uses:="nl.esi.xtext.types.generator, - org.eclipse.xtext.generator, - org.eclipse.emf.ecore.resource, - nl.esi.xtext.expressions.expression", - nl.esi.xtext.expressions.generator.plantuml;uses:="nl.esi.xtext.types.generator,org.eclipse.xtext.generator,nl.esi.xtext.expressions.expression", - nl.esi.xtext.expressions.parser.antlr;uses:="org.eclipse.xtext.parser.antlr,nl.esi.xtext.expressions.parser.antlr.internal,nl.esi.xtext.expressions.services", - nl.esi.xtext.expressions.parser.antlr.internal; - uses:="org.eclipse.emf.ecore, - org.eclipse.emf.common.util, - org.eclipse.xtext.parser.antlr, - nl.esi.xtext.expressions.services, - org.antlr.runtime", - nl.esi.xtext.expressions.scoping; - uses:="org.eclipse.emf.ecore, - org.eclipse.xtext.scoping, - nl.esi.xtext.expressions.expression", - nl.esi.xtext.expressions.serializer; - uses:="org.eclipse.emf.ecore, - org.eclipse.xtext.nodemodel, - org.eclipse.xtext.serializer.analysis, - nl.esi.xtext.types.serializer, - nl.esi.xtext.expressions.services, - org.eclipse.xtext.serializer.sequencer, - org.eclipse.xtext, - org.eclipse.xtext.serializer, - nl.esi.xtext.expressions.expression", - nl.esi.xtext.expressions.services;uses:="nl.esi.xtext.types.services,org.eclipse.xtext.service,org.eclipse.xtext", - nl.esi.xtext.expressions.utilities;uses:="org.eclipse.emf.ecore,nl.esi.xtext.types.utilities,nl.esi.xtext.expressions.expression", - nl.esi.xtext.expressions.validation; - uses:="org.eclipse.emf.ecore, - org.eclipse.xtext.scoping, - nl.esi.xtext.types.types, - nl.esi.xtext.expressions.expression" Import-Package: org.apache.log4j Automatic-Module-Name: nl.esi.xtext.expressions diff --git a/bundles/nl.esi.xtext.expressions/src/nl/esi/xtext/expressions/utilities/ExpressionsUtilities.xtend b/bundles/nl.esi.xtext.expressions/src/nl/esi/xtext/expressions/utilities/ExpressionsUtilities.xtend index 84bf985..c02abee 100644 --- a/bundles/nl.esi.xtext.expressions/src/nl/esi/xtext/expressions/utilities/ExpressionsUtilities.xtend +++ b/bundles/nl.esi.xtext.expressions/src/nl/esi/xtext/expressions/utilities/ExpressionsUtilities.xtend @@ -322,23 +322,27 @@ class ExpressionsUtilities { /** * Recursively substitute generic type parameters in a type structure. */ - private def static Type substituteGenerics(Type type, Map resolutionMap) { - if (type === null) return null - return switch (type) { + private def static Type substituteGenerics(Type targetType, Map resolutionMap) { + if (targetType === null) return null + return switch (targetType) { VectorTypeConstructor: createVectorTypeConstructor => [ - type = substituteGenerics(type.typeObject.elementType.asType, resolutionMap).type - dimensions += type.dimensions.copyAll + val substituteType = resolutionMap.get(targetType.type) + type = substituteGenerics(targetType.typeObject.elementType.asType, resolutionMap).type + if(substituteType.isVectorType) { + dimensions += substituteType.dimensions.copyAll + } + dimensions += targetType.dimensions.copyAll ] MapTypeConstructor: createMapTypeConstructor => [ - type = substituteGenerics(type.typeObject.keyType.asType, resolutionMap).type - valueType = substituteGenerics(type.typeObject.valueType.asType, resolutionMap).asExprType + type = substituteGenerics(targetType.typeObject.keyType.asType, resolutionMap).type + valueType = substituteGenerics(targetType.typeObject.valueType.asType, resolutionMap).asExprType ] TypeReference: { // resolve generics or just the original type decl - return resolutionMap.getOrDefault(type.type,type) + return resolutionMap.getOrDefault(targetType.type,targetType) } default: - type + targetType } } diff --git a/bundles/nl.esi.xtext.launch/Launch Runtime Eclipse.launch b/bundles/nl.esi.xtext.launch/Launch Runtime Eclipse.launch index bd540f7..8539978 100644 --- a/bundles/nl.esi.xtext.launch/Launch Runtime Eclipse.launch +++ b/bundles/nl.esi.xtext.launch/Launch Runtime Eclipse.launch @@ -74,13 +74,6 @@ - - - - - - - diff --git a/bundles/nl.esi.xtext.types/META-INF/MANIFEST.MF b/bundles/nl.esi.xtext.types/META-INF/MANIFEST.MF index c5cfa90..ff5543f 100644 --- a/bundles/nl.esi.xtext.types/META-INF/MANIFEST.MF +++ b/bundles/nl.esi.xtext.types/META-INF/MANIFEST.MF @@ -16,7 +16,6 @@ Require-Bundle: nl.esi.xtext.common.lang;visibility:=reexport, org.eclipse.xtext.xbase.lib;bundle-version="2.15.0", org.apache.commons.lang;bundle-version="2.6.0", org.apache.commons.cli, - net.sourceforge.plantuml.lib;bundle-version="1.2017.15", org.eclipse.core.runtime;bundle-version="3.16.0", org.eclipse.e4.core.di;bundle-version="1.7.400", org.eclipse.core.resources diff --git a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/TypeUtilities.xtend b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/TypeUtilities.xtend index acf7ba7..42edfce 100644 --- a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/TypeUtilities.xtend +++ b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/TypeUtilities.xtend @@ -31,6 +31,7 @@ import nl.esi.xtext.types.types.VectorTypeConstructor import nl.esi.xtext.types.types.VectorTypeDecl import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.util.EcoreUtil +import nl.esi.xtext.types.types.Dimension class TypeUtilities { /* @@ -61,6 +62,16 @@ class TypeUtilities { def static boolean isVectorType(Type t){ return t.getTypeObject.isVectorType } + + def static List getDimensions(Type t){ + if(t instanceof VectorTypeConstructor) { + return t.dimensions + } + if (t instanceof VectorTypeDecl) { + return t.constructor.dimensions + } + return List.of + } def static boolean isVectorType(TypeObject t){ t instanceof VectorTypeConstructor || t instanceof VectorTypeDecl diff --git a/features/nl.esi.xplus.feature/feature.xml b/features/nl.esi.xplus.feature/feature.xml index b353dfe..53a26d6 100644 --- a/features/nl.esi.xplus.feature/feature.xml +++ b/features/nl.esi.xplus.feature/feature.xml @@ -31,10 +31,6 @@ Languages. %license - - - - diff --git a/releng/nl.esi.xplus.standard.site/category.xml b/releng/nl.esi.xplus.standard.site/category.xml index 1c250cf..3397cc1 100644 --- a/releng/nl.esi.xplus.standard.site/category.xml +++ b/releng/nl.esi.xplus.standard.site/category.xml @@ -38,9 +38,6 @@ - - - XPlus Framework diff --git a/releng/nl.esi.xplus.target/nl.esi.xplus.target.target b/releng/nl.esi.xplus.target/nl.esi.xplus.target.target index 09739c0..510a716 100644 --- a/releng/nl.esi.xplus.target/nl.esi.xplus.target.target +++ b/releng/nl.esi.xplus.target/nl.esi.xplus.target.target @@ -72,11 +72,7 @@ - - - - - +