Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358512 - allSubobjects() should not operate on collections
Summary: allSubobjects() should not operate on collections
Status: CLOSED WONTFIX
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-22 02:26 EDT by Wilbert Alberts CLA
Modified: 2013-12-25 10:54 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wilbert Alberts CLA 2011-09-22 02:26:25 EDT
Build Identifier: Build id: 20110615-0604

It turns out that it is possible to invoke allSubobjects on a set. E.g:
var m: OrderedSet(Element)
var sm := m->allSubobjects()

However, allSubobjects() operates on Element and a collection does conform to an Element.

Reproducible: Always

Steps to Reproduce:
1. Create a QVT transformation containing the code shown in the details.
2. Execute it and see that it runs.
3. It shouldn't ;-)
Comment 1 Sergey Boyko CLA 2013-12-25 10:54:32 EST
Expression 
  var sm := m->allSubobjects()
is the shorthand for the following
  var sm := m->xcollect(i | i.allSubobjects())

This is due to specification, Section 8.2.2.7 ImperativeIterateExp :
"
If a property is invoked with "->" symbol and no “bracket” follows, this means that xcollect construct is being used.
  list->prop; // same as list->xcollect(i | i.prop), the iterator variable is implicit here
"