eclipse-qvtd / org.eclipse.qvtd

Eclipse Public License 2.0
0 stars 0 forks source link

[cg] Common subexpressions can be repeated #407

Open eclipse-qvtd-bot opened 17 hours ago

eclipse-qvtd-bot commented 17 hours ago

| --- | --- | | Bugzilla Link | 550603 | | Status | NEW | | Importance | P3 normal | | Reported | Aug 30, 2019 10:56 EDT | | Modified | Aug 30, 2019 10:56 EDT | | Reporter | Ed Willink |

Description

The following QVTr shared variable:

allSurnames : OrderedSet(String) = pr.persons->collect(p | getSurname(p))->asOrderedSet();

appears in QVTi as:

var persons : OrderedSet(mm_PersonsMM::Person[*|1])[1] := pr.persons;\
var allSurnames : OrderedSet(String[*|1])[1] := persons->collect(p : mm_PersonsMM::Person |\
    this.getSurname(p))->asOrderedSet();\
var collect : Sequence(String[*|1])[1] := persons->collect(p : mm_PersonsMM::Person | this.getSurname(p));

evaluating collect() twice!

Workaround:

allSurname1 = pr.persons->collect(p | getSurname(p));\ allSurnames : OrderedSet(String) = allSurname1->asOrderedSet();