diff --git a/.gitignore b/.gitignore
index e8b7dfc37..5c71c9b05 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,7 +21,6 @@ rosetta-profiling/reports/
**/xtend-gen/
**/emf-gen/
**/src/generated/
-**/xsemantics-gen/
.antlr-generator-3.2.0-patch.jar
com.regnosys.rosetta.web/
diff --git a/README.md b/README.md
index 61d70f8b3..820742253 100644
--- a/README.md
+++ b/README.md
@@ -82,13 +82,6 @@ Install the latest version of the "Eclipse IDE for Java and DSL Developers" usin
#### Install the Checkstyle plugin
We use [Checkstyle](https://checkstyle.sourceforge.io/) for enforcing good coding practices. The Eclipse plugin for Checkstyle can be found here: [https://checkstyle.org/eclipse-cs/#!/](https://checkstyle.org/eclipse-cs/#!/).
-#### Install the Xsemantics plugin
-We use the [Xsemantics DSL](https://github.com/eclipse/xsemantics) to define the type system of Rune. To enable language support for it in Eclipse, follow these steps:
-1. Find out which version of Xsemantics you need by looking in the `pom.xml` file of the parent project. There should be a property called `xsemantics.version`.
-2. Go to Help > Install New Software...
-3. In 'Work with' fill in [https://download.eclipse.org/xsemantics/milestones/](https://download.eclipse.org/xsemantics/milestones/).
-4. Install the appropriate version of XSemantics.
-
#### Setup the project
1. **Open the project in Eclipse**: File > Open Projects from File System..., select the right folder, click Finish.
2. **Update Maven dependencies**: right click on the `com.regnosys.rosetta.parent` project > Maven > Update project... and finish.
@@ -106,7 +99,6 @@ If you're seeing 1000+ errors in the "Problems" window of Eclipse, try the follo
Support for developing Xtext projects in Intellij is limited. It has no support for
- editing `Xtend` files
- editing the `Xtext` file
-- editing the `Xsemantics` file
- running `GenerateRosetta.mwe2`.
You can however let Maven take care of that, and still edit regular Java files, run tests, etc.
diff --git a/pom.xml b/pom.xml
index 0f318bcdb..b334e17d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,7 +101,6 @@
2.27.0
3.14.0
1.12.0
- 1.22.0
2.2
1.6.0
3.9.8
@@ -275,22 +274,6 @@
org.eclipse.emf.ecore.xcore.lib
${org.eclipse.emf.ecore.xcore.lib.version}
-
- org.eclipse.xsemantics
- org.eclipse.xsemantics.runtime
- ${xsemantics.version}
-
-
- ch.qos.reload4j
- reload4j
-
-
-
-
- org.eclipse.xsemantics
- org.eclipse.xsemantics.dsl
- ${xsemantics.version}
-
org.yaml
snakeyaml
@@ -451,7 +434,6 @@
-
diff --git a/rosetta-ide/rosetta.tmLanguage.yaml b/rosetta-ide/rosetta.tmLanguage.yaml
index d3ef0e765..7bdaced2f 100644
--- a/rosetta-ide/rosetta.tmLanguage.yaml
+++ b/rosetta-ide/rosetta.tmLanguage.yaml
@@ -36,7 +36,7 @@ variables:
unambiguousRootEnd: (?={{unambiguousRootStart}})
sectionStart: '{{wordStart}}((post-)?condition|set|add|inputs|output|alias){{wordEnd}}'
sectionEnd: (?={{sectionStart}}|{{rootStart}})(?!\bcondition\b)|(?=\bcondition\b\s*({{identifier}})?:)
- functionalOperation: '{{wordStart}}(reduce|filter|map|extract|sort|min|max){{wordEnd}}'
+ functionalOperation: '{{wordStart}}(reduce|filter|extract|sort|min|max){{wordEnd}}'
listOperationWord: '{{functionalOperation}}|{{wordStart}}(single|multiple|exists|is|absent|only-element|count|flatten|distinct|reverse|first|last|sum){{wordEnd}}'
listOperation: ->>|->|{{listOperationWord}}
synonymAnnotationSimpleSection: '{{wordStart}}(value|meta|definition|pattern|removeHtml|dateFormat|mapper|hint|merge|condition-func|condition-path){{wordEnd}}'
diff --git a/rosetta-ide/src/main/java/com/regnosys/rosetta/ide/quickfix/RosettaQuickFixProvider.java b/rosetta-ide/src/main/java/com/regnosys/rosetta/ide/quickfix/RosettaQuickFixProvider.java
index 78d6dd70f..775d325f3 100644
--- a/rosetta-ide/src/main/java/com/regnosys/rosetta/ide/quickfix/RosettaQuickFixProvider.java
+++ b/rosetta-ide/src/main/java/com/regnosys/rosetta/ide/quickfix/RosettaQuickFixProvider.java
@@ -69,15 +69,4 @@ public void fixMandatoryThen(DiagnosticResolutionAcceptor acceptor) {
return List.of(edit);
});
}
-
- @QuickFix(RosettaIssueCodes.DEPRECATED_MAP)
- public void fixDeprecatedMap(DiagnosticResolutionAcceptor acceptor) {
- acceptor.accept("Replace with `extract`.", (Diagnostic diagnostic, EObject object, Document document) -> {
- RosettaUnaryOperation op = (RosettaUnaryOperation)object;
- Range range = rangeUtils.getRange(op, ROSETTA_OPERATION__OPERATOR);
- String edited = "extract";
- TextEdit edit = new TextEdit(range, edited);
- return List.of(edit);
- });
- }
}
diff --git a/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/contentassist/ContentAssistTest.xtend b/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/contentassist/ContentAssistTest.xtend
index 41bcf0bba..54c08731e 100644
--- a/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/contentassist/ContentAssistTest.xtend
+++ b/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/contentassist/ContentAssistTest.xtend
@@ -45,7 +45,6 @@ class ContentAssistTest extends AbstractRosettaLanguageServerTest {
is -> is [[9, 14] .. [9, 14]]
join -> join [[9, 14] .. [9, 14]]
last -> last [[9, 14] .. [9, 14]]
- map -> map [[9, 14] .. [9, 14]]
max -> max [[9, 14] .. [9, 14]]
min -> min [[9, 14] .. [9, 14]]
multiple -> multiple [[9, 14] .. [9, 14]]
@@ -134,7 +133,6 @@ class ContentAssistTest extends AbstractRosettaLanguageServerTest {
join -> join [[7, 27] .. [7, 27]]
last -> last [[7, 27] .. [7, 27]]
library -> library [[7, 27] .. [7, 27]]
- map -> map [[7, 27] .. [7, 27]]
max -> max [[7, 27] .. [7, 27]]
metaType -> metaType [[7, 27] .. [7, 27]]
min -> min [[7, 27] .. [7, 27]]
@@ -219,7 +217,6 @@ class ContentAssistTest extends AbstractRosettaLanguageServerTest {
is -> is [[6, 25] .. [6, 25]]
join -> join [[6, 25] .. [6, 25]]
last -> last [[6, 25] .. [6, 25]]
- map -> map [[6, 25] .. [6, 25]]
max -> max [[6, 25] .. [6, 25]]
min -> min [[6, 25] .. [6, 25]]
multiple -> multiple [[6, 25] .. [6, 25]]
@@ -414,7 +411,6 @@ class ContentAssistTest extends AbstractRosettaLanguageServerTest {
item -> item [[19, 2] .. [19, 2]]
join -> join [[19, 2] .. [19, 2]]
last -> last [[19, 2] .. [19, 2]]
- map -> map [[19, 2] .. [19, 2]]
max -> max [[19, 2] .. [19, 2]]
min -> min [[19, 2] .. [19, 2]]
multiple -> multiple [[19, 2] .. [19, 2]]
diff --git a/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/quickfix/QuickFixTest.xtend b/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/quickfix/QuickFixTest.xtend
index 5af1e88c8..03bcc52b3 100644
--- a/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/quickfix/QuickFixTest.xtend
+++ b/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/quickfix/QuickFixTest.xtend
@@ -29,7 +29,7 @@ class QuickFixTest extends AbstractRosettaLanguageServerTest {
'''
testCodeAction[
it.model = model
- assertCodeActions = [
+ it.assertCodeActions = [
assertEquals(2, size)
val sorted = it.sortWith[a,b| ru.comparePositions(a.getRight.diagnostics.head.range.start, b.getRight.diagnostics.head.range.start)]
@@ -54,37 +54,4 @@ class QuickFixTest extends AbstractRosettaLanguageServerTest {
]
]
}
-
- @Test
- def testQuickFixDeprecatedMap() {
- val model = '''
- namespace foo.bar
-
- type Foo:
- a int (1..1)
-
- func Bar:
- inputs: foo Foo (1..1)
- output: result int (1..1)
-
- set result: foo map a
- '''
- testCodeAction[
- it.model = model
- assertCodeActions = [
- assertEquals(1, size)
-
- val sorted = it.sortWith[a,b| ru.comparePositions(a.getRight.diagnostics.head.range.start, b.getRight.diagnostics.head.range.start)]
-
- sorted.get(0).getRight => [
- assertEquals("Replace with `extract`.", title)
- edit.changes.values.head.head => [
- assertEquals("extract", newText)
- assertEquals(new Position(9, 17), range.start)
- assertEquals(new Position(9, 20), range.end)
- ]
- ]
- ]
- ]
- }
}
\ No newline at end of file
diff --git a/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/server/ChangeDetectionTest.xtend b/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/server/ChangeDetectionTest.xtend
index b3a10c781..2f2d3809f 100644
--- a/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/server/ChangeDetectionTest.xtend
+++ b/rosetta-ide/src/test/java/com/regnosys/rosetta/ide/server/ChangeDetectionTest.xtend
@@ -32,7 +32,7 @@ class ChangeDetectionTest extends AbstractRosettaLanguageServerValidationTest {
// There should be a type error in func `Foo`
val issues = diagnostics.get(funcsURI)
assertEquals(1, issues.size)
- assertEquals("Expected type 'int' but was 'string'", issues.head.message)
+ assertEquals("Expected type `int`, but got `string` instead. Cannot assign `string` to output `result`", issues.head.message)
}
@Test
@@ -62,7 +62,7 @@ class ChangeDetectionTest extends AbstractRosettaLanguageServerValidationTest {
// There should be a cardinality error in func `Foo`
val issues = diagnostics.get(funcsURI)
assertEquals(1, issues.size)
- assertEquals("Cardinality mismatch - cannot assign list to a single value.", issues.head.message)
+ assertEquals("Expecting single cardinality. Cannot assign a list to a single value", issues.head.message)
}
@Test
@@ -107,7 +107,7 @@ class ChangeDetectionTest extends AbstractRosettaLanguageServerValidationTest {
// There should be a type error in func `Foo`
val issues = diagnostics.get(funcsURI)
assertEquals(1, issues.size)
- assertEquals("Expected type 'MyType' but was 'MyType'", issues.head.message)
+ assertEquals("Expected type `foo.MyType`, but got `bar.MyType` instead. Cannot assign `bar.MyType` to output `result`", issues.head.message)
}
@Test
@@ -133,8 +133,8 @@ class ChangeDetectionTest extends AbstractRosettaLanguageServerValidationTest {
// There should be a type error in rule B
val issues = diagnostics.get(ruleBURI)
- assertEquals(2, issues.size)
- assertEquals("Expected type 'int' but was 'string'", issues.head.message)
+ assertEquals(1, issues.size)
+ assertEquals("Expected type `int`, but got `string` instead. Rule `A` cannot be called with type `string`", issues.head.message)
}
@Test
@@ -164,6 +164,6 @@ class ChangeDetectionTest extends AbstractRosettaLanguageServerValidationTest {
// There should be a type error in func Foo
val issues = diagnostics.get(funcURI)
assertEquals(1, issues.size)
- assertEquals("Expected type 'int' but was 'string'", issues.head.message)
+ assertEquals("Expected type `int`, but got `string` instead. Cannot assign `string` to output `result`", issues.head.message)
}
}
diff --git a/rosetta-lang/model/Rosetta.xcore b/rosetta-lang/model/Rosetta.xcore
index dac7ee3c6..07c2e8daf 100644
--- a/rosetta-lang/model/Rosetta.xcore
+++ b/rosetta-lang/model/Rosetta.xcore
@@ -110,7 +110,7 @@ class RosettaExternalFunction extends RosettaRootElement, RosettaTyped, RosettaC
}
}
-class RosettaParameter extends RosettaTyped, RosettaNamed {
+class RosettaParameter extends RosettaTyped, RosettaSymbol {
boolean isArray
}
diff --git a/rosetta-lang/pom.xml b/rosetta-lang/pom.xml
index 7321b1f45..a444697c4 100644
--- a/rosetta-lang/pom.xml
+++ b/rosetta-lang/pom.xml
@@ -55,10 +55,6 @@
org.eclipse.xtext
org.eclipse.xtext
-
- org.eclipse.xsemantics
- org.eclipse.xsemantics.runtime
-
org.eclipse.emf
org.eclipse.emf.ecore.xcore.lib
@@ -124,12 +120,6 @@
**/*
-
- ${basedir}/../rosetta-lang/xsemantics-gen
-
- **/*
-
-
${basedir}/../rosetta-lang/xtend-gen
@@ -184,7 +174,7 @@
xtext-maven-plugin
- xcore-and-xsemantics-generator
+ xcore-generator
generate-sources
generate
@@ -194,7 +184,7 @@
${maven.compiler.release}
${maven.compiler.release}
-
+
true
@@ -224,16 +214,6 @@
-
-
- org.eclipse.xsemantics.dsl.XsemanticsStandaloneSetup
-
-
-
- ${project.basedir}/xsemantics-gen/main/java
-
-
-
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/Rosetta.xtext b/rosetta-lang/src/main/java/com/regnosys/rosetta/Rosetta.xtext
index 33bdbe341..894fb4960 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/Rosetta.xtext
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/Rosetta.xtext
@@ -683,7 +683,7 @@ UnaryOperation returns RosettaExpression:
({ReduceOperation.argument=current} operator='reduce')
|({FilterOperation.argument=current} operator='filter')
// @Compat: remove `map`
- |({MapOperation.argument=current} operator=('map' | 'extract'))
+ |({MapOperation.argument=current} operator='extract')
) (function=InlineFunction|=>function=ImplicitInlineFunction)?
)*
| // Without left parameter:
@@ -720,7 +720,7 @@ UnaryOperation returns RosettaExpression:
({ReduceOperation} operator='reduce')
|({FilterOperation} operator='filter')
// @Compat: remove `map`
- |({MapOperation} operator=('map' | 'extract'))
+ |({MapOperation} operator='extract')
) (function=InlineFunction|=>function=ImplicitInlineFunction)?
)
(
@@ -758,7 +758,7 @@ UnaryOperation returns RosettaExpression:
({ReduceOperation.argument=current} operator='reduce')
|({FilterOperation.argument=current} operator='filter')
// @Compat: remove `map`
- |({MapOperation.argument=current} operator=('map' | 'extract'))
+ |({MapOperation.argument=current} operator='extract')
) (function=InlineFunction|=>function=ImplicitInlineFunction)?
)*
;
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/RosettaRuntimeModule.xtend b/rosetta-lang/src/main/java/com/regnosys/rosetta/RosettaRuntimeModule.xtend
index a6de2036a..1abc6ea9a 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/RosettaRuntimeModule.xtend
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/RosettaRuntimeModule.xtend
@@ -23,24 +23,14 @@ import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy
import org.eclipse.xtext.parser.IEncodingProvider
import com.google.inject.Binder
import org.eclipse.xtext.service.DispatchingProvider
-import com.regnosys.rosetta.utils.ImplicitVariableUtil
-import org.eclipse.xsemantics.runtime.validation.XsemanticsValidatorFilter
-import com.regnosys.rosetta.validation.RetainXsemanticsIssuesOnGeneratedInputsFilter
import org.eclipse.xtext.conversion.IValueConverterService
import com.regnosys.rosetta.parsing.RosettaValueConverterService
-import com.regnosys.rosetta.parsing.BigDecimalConverter
import com.regnosys.rosetta.transgest.ModelLoader
import com.regnosys.rosetta.transgest.ModelLoaderImpl
-import com.regnosys.rosetta.formatting2.RosettaExpressionFormatter
-import com.regnosys.rosetta.formatting2.FormattingUtil
import javax.inject.Provider
-import com.regnosys.rosetta.generator.java.util.RecordJavaUtil
import com.regnosys.rosetta.serialization.RosettaTransientValueService
import org.eclipse.xtext.parsetree.reconstr.ITransientValueService
import com.regnosys.rosetta.resource.RosettaResource
-import com.regnosys.rosetta.typing.RosettaTyping
-import com.regnosys.rosetta.typing.RosettaTypingAuxiliary
-import com.regnosys.rosetta.typing.RosettaTypingChecking
import org.eclipse.xtext.validation.IResourceValidator
import com.regnosys.rosetta.validation.CachingResourceValidator
import com.regnosys.rosetta.config.RosettaConfiguration
@@ -53,16 +43,6 @@ import com.regnosys.rosetta.formatting2.ResourceFormatterService
/* Use this class to register components to be used at runtime / without the Equinox extension registry.*/
class RosettaRuntimeModule extends AbstractRosettaRuntimeModule {
- def void configureXsemanticsTypeSystem(Binder binder) {
- // During a language server build, the following three classes are injected over and over again
- // for each Rosetta resource. This means that code generation is spending up to 54% of its time
- // just injecting these classes. By binding them as singletons, this time virtually disappears
- // since they will only be instantiated once.
- binder.bind(RosettaTyping).asEagerSingleton
- binder.bind(RosettaTypingAuxiliary).asEagerSingleton
- binder.bind(RosettaTypingChecking).asEagerSingleton
- }
-
override Class extends IFragmentProvider> bindIFragmentProvider() {
RosettaFragmentProvider
}
@@ -101,19 +81,9 @@ class RosettaRuntimeModule extends AbstractRosettaRuntimeModule {
.to(UTF8EncodingProvider);
}
- def Class extends ImplicitVariableUtil> bindImplicitVariableUtil() {
- ImplicitVariableUtil
- }
- def Class extends XsemanticsValidatorFilter> bindXsemanticsValidatorFilter() {
- RetainXsemanticsIssuesOnGeneratedInputsFilter
- }
-
override Class extends IValueConverterService> bindIValueConverterService() {
RosettaValueConverterService
}
- def Class extends BigDecimalConverter> bindBigDecimalConverter() {
- BigDecimalConverter
- }
override Class extends XtextResource> bindXtextResource() {
RosettaResource
@@ -126,19 +96,6 @@ class RosettaRuntimeModule extends AbstractRosettaRuntimeModule {
ModelLoaderImpl
}
-
- def Class extends RosettaExpressionFormatter> bindRosettaExpressionFormatter() {
- RosettaExpressionFormatter
- }
-
- def Class extends FormattingUtil> bindFormattingUtil() {
- FormattingUtil
- }
-
- def Class extends RecordJavaUtil> bindRecordFeatureMap() {
- RecordJavaUtil
- }
-
def Class extends IResourceValidator> bindIResourceValidator() {
CachingResourceValidator
}
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/generator/java/expression/DeepPathUtilGenerator.xtend b/rosetta-lang/src/main/java/com/regnosys/rosetta/generator/java/expression/DeepPathUtilGenerator.xtend
index 661b9355a..446cb2620 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/generator/java/expression/DeepPathUtilGenerator.xtend
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/generator/java/expression/DeepPathUtilGenerator.xtend
@@ -105,7 +105,7 @@ class DeepPathUtilGenerator {
for (a : attrs.reverseView) {
val currAcc = acc
acc = inputParameter
- .attributeCall(choiceType.withEmptyMeta, a, false, a.toMetaJavaType, scope)
+ .attributeCall(choiceType.withNoMeta, a, false, a.toMetaJavaType, scope)
.declareAsVariable(true, a.name.toFirstLower, scope)
.mapExpression[attrVar|
attrVar.exists(ExistsModifier.NONE, scope)
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/generator/java/expression/ExpressionGenerator.xtend b/rosetta-lang/src/main/java/com/regnosys/rosetta/generator/java/expression/ExpressionGenerator.xtend
index f93282bd1..7f9e53571 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/generator/java/expression/ExpressionGenerator.xtend
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/generator/java/expression/ExpressionGenerator.xtend
@@ -98,7 +98,6 @@ import com.regnosys.rosetta.types.RFunction
import com.regnosys.rosetta.types.RMetaAnnotatedType
import com.regnosys.rosetta.types.RObjectFactory
import com.regnosys.rosetta.types.RShortcut
-import com.regnosys.rosetta.types.RosettaOperators
import com.regnosys.rosetta.types.RosettaTypeProvider
import com.regnosys.rosetta.types.TypeSystem
import com.regnosys.rosetta.types.builtin.RBasicType
@@ -136,9 +135,9 @@ import org.eclipse.xtext.EcoreUtil2
import org.eclipse.xtext.xbase.lib.Functions.Function3
import static extension com.regnosys.rosetta.generator.java.enums.EnumHelper.convertValue
-import static extension com.regnosys.rosetta.types.RMetaAnnotatedType.withEmptyMeta
import com.regnosys.rosetta.generator.java.types.RJavaFieldWithMeta
import com.regnosys.rosetta.generator.java.types.RJavaWithMetaValue
+import static extension com.regnosys.rosetta.types.RMetaAnnotatedType.withNoMeta
class ExpressionGenerator extends RosettaExpressionSwitch {
@@ -148,7 +147,6 @@ class ExpressionGenerator extends RosettaExpressionSwitch caseTimeType(RBasicType type, Void context) {
return typeUtil.LOCAL_TIME;
}
@Override
- protected JavaType caseMissingType(RBasicType type, Void context) {
- throw new IllegalArgumentException("Cannot convert a missing type to a Java type.");
- }
- @Override
protected JavaClass caseNothingType(RBasicType type, Void context) {
return typeUtil.VOID;
}
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/interpreter/RosettaValueFactory.java b/rosetta-lang/src/main/java/com/regnosys/rosetta/interpreter/RosettaValueFactory.java
index 3dff8ed78..02013008a 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/interpreter/RosettaValueFactory.java
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/interpreter/RosettaValueFactory.java
@@ -29,7 +29,6 @@
import com.regnosys.rosetta.types.RChoiceType;
import com.regnosys.rosetta.types.RDataType;
import com.regnosys.rosetta.types.REnumType;
-import com.regnosys.rosetta.types.RErrorType;
import com.regnosys.rosetta.types.RType;
import com.regnosys.rosetta.types.builtin.RBasicType;
import com.regnosys.rosetta.types.builtin.RBuiltinTypeService;
@@ -61,11 +60,6 @@ public RosettaValue createOfType(RType type, Object item) {
return createOfType(type, List.of(item));
}
- @Override
- protected RosettaValue caseErrorType(RErrorType type, List> context) {
- throw new UnsupportedOperationException("Cannot create a value of error type " + type);
- }
-
@Override
protected RosettaValue caseDataType(RDataType type, List> context) {
throw new UnsupportedOperationException("Data type is unsupported");
@@ -111,11 +105,6 @@ protected RosettaValue caseTimeType(RBasicType type, List> context) {
// return new RosettaPatternValue(castList(context, Pattern.class));
// }
- @Override
- protected RosettaValue caseMissingType(RBasicType type, List> context) {
- throw new UnsupportedOperationException("Cannot create a value of a missing type");
- }
-
@Override
protected RosettaValue caseNothingType(RBasicType type, List> context) {
if (!context.isEmpty()) {
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/scoping/RosettaScopeProvider.xtend b/rosetta-lang/src/main/java/com/regnosys/rosetta/scoping/RosettaScopeProvider.xtend
index 972bd0f93..7f2511c88 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/scoping/RosettaScopeProvider.xtend
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/scoping/RosettaScopeProvider.xtend
@@ -62,7 +62,7 @@ import static com.regnosys.rosetta.rosetta.RosettaPackage.Literals.*
import static com.regnosys.rosetta.rosetta.expression.ExpressionPackage.Literals.*
import static com.regnosys.rosetta.rosetta.simple.SimplePackage.Literals.*
-import static extension com.regnosys.rosetta.types.RMetaAnnotatedType.withEmptyMeta
+import static extension com.regnosys.rosetta.types.RMetaAnnotatedType.withNoMeta
import com.regnosys.rosetta.rosetta.simple.Attribute
/**
@@ -110,13 +110,13 @@ class RosettaScopeProvider extends ImportedNamespaceAwareLocalScopeProvider {
}
case CHOICE_OPERATION__ATTRIBUTES: {
if (context instanceof ChoiceOperation) {
- return createExtendedFeatureScope(context.argument, typeProvider.getRMetaAnnotatedType(context.argument).RType.withEmptyMeta)
+ return createExtendedFeatureScope(context.argument, typeProvider.getRMetaAnnotatedType(context.argument).RType.withNoMeta)
}
return IScope.NULLSCOPE
}
case ROSETTA_ATTRIBUTE_REFERENCE__ATTRIBUTE: {
if (context instanceof RosettaAttributeReference) {
- return createExtendedFeatureScope(context.receiver, typeProvider.getRTypeOfAttributeReference(context.receiver).withEmptyMeta)
+ return createExtendedFeatureScope(context.receiver, typeProvider.getRTypeOfAttributeReference(context.receiver).withNoMeta)
}
return IScope.NULLSCOPE
}
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/CardinalityProvider.xtend b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/CardinalityProvider.xtend
index b801396d0..18a75f701 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/CardinalityProvider.xtend
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/CardinalityProvider.xtend
@@ -72,6 +72,7 @@ import com.regnosys.rosetta.rosetta.expression.RosettaDeepFeatureCall
import com.regnosys.rosetta.rosetta.expression.DefaultOperation
import com.regnosys.rosetta.rosetta.expression.SwitchOperation
import com.regnosys.rosetta.rosetta.expression.SwitchCase
+import com.regnosys.rosetta.rosetta.RosettaParameter
class CardinalityProvider extends RosettaExpressionSwitch {
static Logger LOGGER = LoggerFactory.getLogger(CardinalityProvider)
@@ -100,6 +101,9 @@ class CardinalityProvider extends RosettaExpressionSwitch {
RosettaFeature: {
isFeatureMulti(symbol as RosettaFeature, breakOnClosureParameter)
}
+ RosettaParameter: {
+ false
+ }
ClosureParameter: {
isClosureParameterMulti(symbol.function)
}
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/ExpectedTypeProvider.java b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/ExpectedTypeProvider.java
index d9cd65dc3..ea5e9fb81 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/ExpectedTypeProvider.java
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/ExpectedTypeProvider.java
@@ -78,7 +78,7 @@
import java.util.Objects;
import javax.inject.Inject;
-import static com.regnosys.rosetta.types.RMetaAnnotatedType.withEmptyMeta;
+import static com.regnosys.rosetta.types.RMetaAnnotatedType.withNoMeta;
@ImplementedBy(ExpectedTypeProvider.Impl.class)
@@ -142,13 +142,13 @@ public RMetaAnnotatedType getExpectedType(EObject owner, EReference reference, i
if (operation instanceof ReduceOperation) {
return getExpectedTypeFromContainer(operation);
} else if (operation instanceof FilterOperation) {
- return withEmptyMeta(builtins.BOOLEAN);
+ return withNoMeta(builtins.BOOLEAN);
} else if (operation instanceof MapOperation) {
return getExpectedTypeFromContainer(operation);
} else if (operation instanceof ThenOperation) {
return getExpectedTypeFromContainer(operation);
} else if (operation instanceof ComparingFunctionalOperation) {
- return withEmptyMeta(builtins.BOOLEAN);
+ return withNoMeta(builtins.BOOLEAN);
} else {
LOGGER.debug("Unexpected functional operation of type " + operation.getClass().getCanonicalName());
}
@@ -244,7 +244,7 @@ protected RMetaAnnotatedType caseListLiteral(ListLiteral expr, Context context)
@Override
protected RMetaAnnotatedType caseConditionalExpression(RosettaConditionalExpression expr, Context context) {
if (ROSETTA_CONDITIONAL_EXPRESSION__IF.equals(context.reference)) {
- return withEmptyMeta(builtins.BOOLEAN);
+ return withNoMeta(builtins.BOOLEAN);
} else if (ROSETTA_CONDITIONAL_EXPRESSION__IFTHEN.equals(context.reference)) {
return getExpectedTypeFromContainer(expr);
} else if (ROSETTA_CONDITIONAL_EXPRESSION__ELSETHEN.equals(context.reference)) {
@@ -306,7 +306,7 @@ protected RMetaAnnotatedType caseSymbolReference(RosettaSymbolReference expr, Co
return typeProvider.getRTypeOfSymbol(fun.getInputs().get(context.index));
} else if (symbol instanceof RosettaRule) {
RosettaRule rule = (RosettaRule)symbol;
- return withEmptyMeta(typeSystem.typeCallToRType(rule.getInput()));
+ return withNoMeta(typeSystem.typeCallToRType(rule.getInput()));
}
}
return null;
@@ -324,27 +324,27 @@ protected RMetaAnnotatedType caseSubtractOperation(ArithmeticOperation expr, Con
@Override
protected RMetaAnnotatedType caseMultiplyOperation(ArithmeticOperation expr, Context context) {
- return withEmptyMeta(builtins.UNCONSTRAINED_NUMBER);
+ return withNoMeta(builtins.UNCONSTRAINED_NUMBER);
}
@Override
protected RMetaAnnotatedType caseDivideOperation(ArithmeticOperation expr, Context context) {
- return withEmptyMeta(builtins.UNCONSTRAINED_NUMBER);
+ return withNoMeta(builtins.UNCONSTRAINED_NUMBER);
}
@Override
protected RMetaAnnotatedType caseJoinOperation(JoinOperation expr, Context context) {
- return withEmptyMeta(builtins.UNCONSTRAINED_STRING);
+ return withNoMeta(builtins.UNCONSTRAINED_STRING);
}
@Override
protected RMetaAnnotatedType caseAndOperation(LogicalOperation expr, Context context) {
- return withEmptyMeta(builtins.BOOLEAN);
+ return withNoMeta(builtins.BOOLEAN);
}
@Override
protected RMetaAnnotatedType caseOrOperation(LogicalOperation expr, Context context) {
- return withEmptyMeta(builtins.BOOLEAN);
+ return withNoMeta(builtins.BOOLEAN);
}
@Override
@@ -501,7 +501,7 @@ protected RMetaAnnotatedType caseToStringOperation(ToStringOperation expr, Conte
@Override
protected RMetaAnnotatedType caseToNumberOperation(ToNumberOperation expr, Context context) {
if (ROSETTA_UNARY_OPERATION__ARGUMENT.equals(context.reference)) {
- return withEmptyMeta(builtins.UNCONSTRAINED_STRING);
+ return withNoMeta(builtins.UNCONSTRAINED_STRING);
}
return null;
}
@@ -509,7 +509,7 @@ protected RMetaAnnotatedType caseToNumberOperation(ToNumberOperation expr, Conte
@Override
protected RMetaAnnotatedType caseToIntOperation(ToIntOperation expr, Context context) {
if (ROSETTA_UNARY_OPERATION__ARGUMENT.equals(context.reference)) {
- return withEmptyMeta(builtins.UNCONSTRAINED_STRING);
+ return withNoMeta(builtins.UNCONSTRAINED_STRING);
}
return null;
}
@@ -517,7 +517,7 @@ protected RMetaAnnotatedType caseToIntOperation(ToIntOperation expr, Context con
@Override
protected RMetaAnnotatedType caseToTimeOperation(ToTimeOperation expr, Context context) {
if (ROSETTA_UNARY_OPERATION__ARGUMENT.equals(context.reference)) {
- return withEmptyMeta(builtins.UNCONSTRAINED_STRING);
+ return withNoMeta(builtins.UNCONSTRAINED_STRING);
}
return null;
}
@@ -525,7 +525,7 @@ protected RMetaAnnotatedType caseToTimeOperation(ToTimeOperation expr, Context c
@Override
protected RMetaAnnotatedType caseToEnumOperation(ToEnumOperation expr, Context context) {
if (ROSETTA_UNARY_OPERATION__ARGUMENT.equals(context.reference)) {
- return withEmptyMeta(builtins.UNCONSTRAINED_STRING);
+ return withNoMeta(builtins.UNCONSTRAINED_STRING);
}
return null;
}
@@ -533,7 +533,7 @@ protected RMetaAnnotatedType caseToEnumOperation(ToEnumOperation expr, Context c
@Override
protected RMetaAnnotatedType caseToDateOperation(ToDateOperation expr, Context context) {
if (ROSETTA_UNARY_OPERATION__ARGUMENT.equals(context.reference)) {
- return withEmptyMeta(builtins.UNCONSTRAINED_STRING);
+ return withNoMeta(builtins.UNCONSTRAINED_STRING);
}
return null;
}
@@ -541,7 +541,7 @@ protected RMetaAnnotatedType caseToDateOperation(ToDateOperation expr, Context c
@Override
protected RMetaAnnotatedType caseToDateTimeOperation(ToDateTimeOperation expr, Context context) {
if (ROSETTA_UNARY_OPERATION__ARGUMENT.equals(context.reference)) {
- return withEmptyMeta(builtins.UNCONSTRAINED_STRING);
+ return withNoMeta(builtins.UNCONSTRAINED_STRING);
}
return null;
}
@@ -549,7 +549,7 @@ protected RMetaAnnotatedType caseToDateTimeOperation(ToDateTimeOperation expr, C
@Override
protected RMetaAnnotatedType caseToZonedDateTimeOperation(ToZonedDateTimeOperation expr, Context context) {
if (ROSETTA_UNARY_OPERATION__ARGUMENT.equals(context.reference)) {
- return withEmptyMeta(builtins.UNCONSTRAINED_STRING);
+ return withNoMeta(builtins.UNCONSTRAINED_STRING);
}
return null;
}
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RErrorType.java b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RErrorType.java
deleted file mode 100644
index 2d7f0483b..000000000
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RErrorType.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2024 REGnosys
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.regnosys.rosetta.types;
-
-import java.util.Objects;
-
-import com.rosetta.model.lib.ModelSymbolId;
-import com.rosetta.util.DottedPath;
-
-// TODO: remove this type
-public class RErrorType extends RType {
- private final String message;
-
- public RErrorType(final String message) {
- super();
- this.message = message;
- }
-
- @Override
- public ModelSymbolId getSymbolId() {
- return null;
- }
-
- @Override
- public String getName() {
- return this.message;
- }
-
- @Override
- public DottedPath getNamespace() {
- return null;
- }
-
- @Override
- public DottedPath getQualifiedName() {
- return DottedPath.of(message);
- }
-
-
- public String getMessage() {
- return this.message;
- }
-
- @Override
- public int hashCode() {
- return 31 * 1 + ((this.message == null) ? 0 : this.message.hashCode());
- }
-
- @Override
- public boolean equals(final Object object) {
- if (object == null) return false;
- if (this.getClass() != object.getClass()) return false;
-
- RErrorType other = (RErrorType) object;
- return Objects.equals(message, other.message);
- }
-}
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RListType.java b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RListType.java
deleted file mode 100644
index b69dbee75..000000000
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RListType.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2024 REGnosys
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.regnosys.rosetta.types;
-
-import java.util.Objects;
-
-import com.regnosys.rosetta.rosetta.RosettaCardinality;
-
-public class RListType {
- private final RType itemType;
- private final RosettaCardinality constraint;
-
- public RListType(RType itemType, RosettaCardinality constraint) {
- this.itemType = itemType;
- this.constraint = constraint;
- }
-
- public RType getItemType() {
- return this.itemType;
- }
- public RosettaCardinality getConstraint() {
- return this.constraint;
- }
-
- public boolean isEmpty() {
- return this.constraint.isEmpty();
- }
- public boolean isOptional() {
- return this.constraint.isOptional();
- }
- public boolean isSingular() {
- return this.constraint.isSingular();
- }
- public boolean isPlural() {
- return this.constraint.isPlural();
- }
-
- @Override
- public String toString() {
- return this.itemType.toString() + " " + constraint.toConstraintString();
- }
-
- @Override
- public boolean equals(final Object object) {
- if (object == null) return false;
- if (this.getClass() != object.getClass()) return false;
-
- final RListType other = (RListType) object;
- return Objects.equals(itemType, other.itemType)
- && this.constraint.constraintEquals(other.constraint);
- }
-
- @Override
- public int hashCode() {
- int hash = 3;
- hash = 53 * hash + (this.itemType == null ? 0 : this.itemType.hashCode());
- hash = 53 * hash + this.constraint.constraintHashCode();
- return hash;
- }
-}
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RMetaAnnotatedType.java b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RMetaAnnotatedType.java
index 68f01f7aa..5d55a5729 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RMetaAnnotatedType.java
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RMetaAnnotatedType.java
@@ -10,12 +10,12 @@ public class RMetaAnnotatedType {
private final RType rType;
private final List metaAttributes;
- public RMetaAnnotatedType(RType rType, List metaAttributes) {
+ private RMetaAnnotatedType(RType rType, List metaAttributes) {
this.rType = rType;
this.metaAttributes = Validate.noNullElements(metaAttributes);
}
-
- public static RMetaAnnotatedType withEmptyMeta(RType rType) {
+
+ public static RMetaAnnotatedType withNoMeta(RType rType) {
return new RMetaAnnotatedType(rType, List.of());
}
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RObjectFactory.java b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RObjectFactory.java
index 19ca76e1b..6ec46e328 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RObjectFactory.java
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RObjectFactory.java
@@ -74,7 +74,7 @@ public RFunction buildRFunction(Function function) {
}
private RAttribute createArtificialAttribute(String name, RType type, boolean isMulti) {
- RMetaAnnotatedType rAnnotatedType = RMetaAnnotatedType.withEmptyMeta(type);
+ RMetaAnnotatedType rAnnotatedType = RMetaAnnotatedType.withNoMeta(type);
return new RAttribute(false, name, null, Collections.emptyList(), rAnnotatedType, isMulti ? RCardinality.UNBOUNDED : RCardinality.OPTIONAL, null, null, this);
}
public RFunction buildRFunction(RosettaRule rule) {
diff --git a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RTypeFunction.java b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RTypeFunction.java
index 0968e1440..064e43256 100644
--- a/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RTypeFunction.java
+++ b/rosetta-lang/src/main/java/com/regnosys/rosetta/types/RTypeFunction.java
@@ -30,20 +30,6 @@ public abstract class RTypeFunction extends AbstractModelSymbol {
public RTypeFunction(DottedPath namespace, String name) {
super(namespace, name);
}
-
- // TODO: limitation of Xsemantics, which doesn't support anonymous classes.
- public static RTypeFunction create(DottedPath namespace, String name, Function