I wonder what the semantics should be of calling a xmap on a null value? For instance as in the example below. Should this raise an exception or should this return an invalid value? The current QVTo implementation returns 'invalid'. The specification only talks about checking the 'when' precondition. Though, I would not expect 'invalid' values to be returned by xmap.
modeltype ecore "strict" uses ecore('http://www.eclipse.org/emf/2002/Ecore');
var a : EAttribute;
var b := a.xmap toEClass();
log ("b", b);
mapping EAttribute::toEClass() : EClass
Doing things with null is generally BAD. Bad things in OCL lead to an invalid value. Bad things in QVTo lead to an exception.
The new QVT 1.3 8.1.20 wording doesn't help that much: Every use of a source value by an ImperativeExpression has an implicit assertion that the source value is not invalid,
therefore using invalid is an assertion failure.
But I'm inclined to take the view that the "a.xmap" is a QVTo extension that emulates an OCL navigation and so returns invalid. Therefore in your example any use of the invalid "b", should throw an exception. But of course "log" is perhaps an "access" rather than "use" and so we don't want addition of a log to a program to add an exception. http://issues.omg.org/browse/QVT14-49 raised.