Bug 517038 - [qvtr] Domain analysis needed for awkward variables
Summary: [qvtr] Domain analysis needed for awkward variables
Status: NEW
Alias: None
Product: QVTd
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 517524
Blocks: 517072
  Show dependency tree
 
Reported: 2017-05-22 01:37 EDT by Ed Willink CLA
Modified: 2017-06-10 08:39 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2017-05-22 01:37:42 EDT
The current example hstm2fstm fails with

java.lang.IllegalStateException: Failed to determine other pattern for leafToStates : Set(HierarchicalStateMachine::State) = hierarchicalToState.oclAsSet()->closure(1_ : HierarchicalStateMachine::State[1] | 1_.nestedStates)->select(1_ : HierarchicalStateMachine::State[?] | 1_.nestedStates->isEmpty()) PREDICATE:hier
	at org.eclipse.qvtd.compiler.internal.qvtr2qvtc.RelationVariableAnalysis.getOtherDomain(RelationVariableAnalysis.java:361)
	at org.eclipse.qvtd.compiler.internal.qvtr2qvtc.RelationVariableAnalysis.synthesize(RelationVariableAnalysis.java:494)

because in:

	top relation HierachicalTransition2FlatTransition
	{
		leafFromStates : Set(hierMM::State) = hierarchicalFromState->closure(nestedStates)->select(nestedStates->isEmpty());
		leafToStates : Set(hierMM::State) = hierarchicalToState->closure(nestedStates)->select(nestedStates->isEmpty());

the eliminated domain analysis is needed to identify the domain of leafFromStates.

Workaround: use the current test version:

  when { ...
    this.getLeafStates(hierarchicalFromState)->includes(leafFromState);
    this.getLeafStates(hierarchicalToState)->includes(leafToState);
  }

that pushes it into a query and so has no problematic variable.

Fix: re-introduce the domain analysis or allow and require non-primitive variables to be declared within their domains.
Comment 1 Ed Willink CLA 2017-05-22 09:07:21 EDT
(In reply to Ed Willink from comment #0)
> The current example hstm2fstm fails with

Bug 517072 deals with the failure to detect the regression in a JUnit test.
Comment 2 Ed Willink CLA 2017-05-23 11:47:31 EDT
For RC1, the problem example has been changed to use a query avoiding the challenging variable, Bug 517072 requires reversion.

This bug requires an analysis that allows the reversion.
Comment 3 Ed Willink CLA 2017-05-31 06:33:30 EDT
(In reply to Ed Willink from comment #0)
> Fix: re-introduce the domain analysis

There never was a QVTrDomainUsageAnalysis.

The 'working' Neon example relied on:

  variableAnalysis.setPredicate(ClassUtil.nonNullState(corePattern.getArea()));
   	// FIXME need QVTrDomainAnalayis

in the AbstractEnforceableRelationDomain2CoreMapping constructor.

and unfortunately the 'predicate' support got lost as VariableAnalysis evolved.
Comment 4 Ed Willink CLA 2017-05-31 07:51:16 EDT
Bug 517524 motivates an AS change so that the domain of shared variables is unambiguous in the AS and so unambiguous for QVTr2QVTc.

The QVTr CS is however ambiguous. Bug 517524 suggests that a QVTo-like @model might disambiguate.

But this should not be necessary. A shared variable can be declared with an explicitly qualified type. For the troublesome case of an endogenous transformation, the multiply-used metamodel may be imported twice with two distinct aliases so that the shared variable qualification uses the appropriate alias. Fine in principle, but not losing the alias during Xtext parsing, and forcing the alias during Xtext serialization may be tricky.
Comment 5 Ed Willink CLA 2017-06-10 08:31:29 EDT
(In reply to Ed Willink from comment #3)
> There never was a QVTrDomainUsageAnalysis.

So we add one to support use of the prevailing ambiguities during CS2AS.