Just a few suggestions.
This construct is OK according to the OCL 2.0 specification (06-05-01) but does not work in Octopus
post: let m : OclMessage = myobject^^getSomething(arg)->first() in m.hasReturned() and m.result() > 100
The problem is with the implementation of the OclMessage template.
------------------------------------------------------
let s : String = '' in true and 1 < 2 or s.oclIsU()
Although this construct is not correct Octopus does not report an error because the analysis gets cut after "1 < 2"
I believe the problem is in
nl.klasse.octopus.expressions.internal.parser.parsetree.ParsedOclExpression
public void arrangeOperators() {
if( operator.getLastAppliedProperty() != null ){
operator.getLastAppliedProperty().setAppliedProperty(tmp);}
}
If you add this else after this condition, it works OK:
else { operator.setAppliedProperty(tmp);
}
-----------------------------------------------------
This construct causes an error
post: Util::myop() and true
Type Util has no property and(Boolean)
myop is a class scope operation returning Boolean.
The problem is in
nl.klasse.octopus.expressions.internal.analysis.expressions.ExpressionAnalyzer
private void analyzeAppliedProperties(ParsedOclExpression tree, IPackage p, Environment env, OclExpression source) throws AnalysisException
If this
lastType = ((OclTypeLiteralExp)source).getReferredClassifier();
is replaced by this (an import is needed)
lastType = ((IOperationCallExp)((OclTypeLiteralExp)source).getAppliedProperty()).getReturnType();
it works.
------------------------------------------------------
The changed files are attached, you can do diff to see the changes.
nl.klasse.octopus.expressions.IOperationCallExp
nl.klasse.octopus.expressions.internal.types.OperationCallExp
nl.klasse.octopus.expressions.internal.parser.parsetree.ParsedOclExpression
nl.klasse.octopus.stdlib.internal.library.StdlibMessageTypes
nl.klasse.octopus.expressions.internal.analysis.expressions.ExpressionAnalyzer
nl.klasse.octopus.stdlib.IOclLibrary
nl.klasse.octopus.stdlib.internal.library.StdlibBasic
nl.klasse.octopus.model.ICollectionType
nl.klasse.octopus.stdlib.internal.types.StdlibCollectionType
ChangedOctopusSrcFiles