MatrixProperties: java.lang.ClassCastException: de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol cannot be cast to de.monticore.lang.math._symboltable.expression.MathArithmeticExpressionSymbol
While creation of the symbol table for model:
Q^{2,2} A = [1, 2; 3, 4];
Q^{2,2} B = [A(1,1), A(1,2), A(2,1), A(2,2)];
the following error occurs:
[INFO] AST: de.monticore.lang.math._ast.ASTMathAssignmentDeclarationStatement@4a07d605
java.lang.ClassCastException: de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol cannot be cast to de.monticore.lang.math._symboltable.expression.MathArithmeticExpressionSymbol
at de.monticore.lang.math._matrixprops.ConstructComplexMatrix.dissolveMathExpression(ConstructComplexMatrix.java:65)
at de.monticore.lang.math._matrixprops.ConstructComplexMatrix.getValue(ConstructComplexMatrix.java:48)
at de.monticore.lang.math._matrixprops.ConstructComplexMatrix.constructComplexMatrix(ConstructComplexMatrix.java:38)
at de.monticore.lang.math._matrixprops.MatrixPropertiesIdentifier.<init>(MatrixPropertiesIdentifier.java:43)
at de.monticore.lang.math._symboltable.MathSymbolTableCreator.endVisit(MathSymbolTableCreator.java:339)
at de.monticore.lang.matrix._visitor.MatrixVisitor.handle(MatrixVisitor.java:98)
at de.monticore.lang.matrix._ast.ASTMathMatrixValueExplicitExpression.accept(ASTMathMatrixValueExplicitExpression.java:71)
at de.monticore.lang.matrix._ast.ASTMathMatrixValueExplicitExpression.accept(ASTMathMatrixValueExplicitExpression.java:87)
at de.monticore.lang.math._visitor.MathVisitor.traverse(MathVisitor.java:471)
at de.monticore.lang.math._visitor.MathVisitor.handle(MathVisitor.java:453)
at de.monticore.lang.math._ast.ASTMathAssignmentDeclarationStatement.accept(ASTMathAssignmentDeclarationStatement.java:92)
at de.monticore.lang.math._visitor.MathVisitor.traverse(MathVisitor.java:142)
at de.monticore.lang.math._visitor.MathVisitor.handle(MathVisitor.java:128)
at de.monticore.lang.math._ast.ASTMathScript.accept(ASTMathScript.java:78)
at de.monticore.lang.math._visitor.MathVisitor.traverse(MathVisitor.java:118)
at de.monticore.lang.math._visitor.MathVisitor.handle(MathVisitor.java:97)
at de.monticore.lang.math._ast.ASTMathCompilationUnit.accept(ASTMathCompilationUnit.java:85)
at de.monticore.lang.math._symboltable.MathSymbolTableCreatorTOP.createFromAST(MathSymbolTableCreatorTOP.java:40)
at de.monticore.lang.math._symboltable.MathModelLoader.createSymbolTableFromAST(MathModelLoader.java:30)
at de.monticore.lang.math._symboltable.MathModelLoader.createSymbolTableFromAST(MathModelLoader.java:15)
at de.monticore.modelloader.ModelingLanguageModelLoader.loadModelsIntoScope(ModelingLanguageModelLoader.java:88)
at de.monticore.symboltable.GlobalScope.loadModels(GlobalScope.java:116)
at de.monticore.symboltable.GlobalScope.resolveMany(GlobalScope.java:94)
at de.monticore.symboltable.CommonScope.resolveMany(CommonScope.java:205)
at de.monticore.symboltable.CommonScope.resolveMany(CommonScope.java:195)
at de.monticore.symboltable.CommonScope.resolveMany(CommonScope.java:399)
at de.monticore.symboltable.CommonScope.resolve(CommonScope.java:210)
at de.monticore.lang.math.MatrixPropertiesTest.createMatrixBySubmatricesTest(MatrixPropertiesTest.java:187)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Process finished with exit code -1
The problem is the creation of matrix properties, which performs invalid type casts.