Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328485 - [editor] Incorrect implicit self in iterator
Summary: [editor] Incorrect implicit self in iterator
Status: CLOSED FIXED
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: M7   Edit
Assignee: OCL Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2010-10-22 11:01 EDT by Ed Willink CLA
Modified: 2013-05-20 11:38 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 2010-10-22 11:01:56 EDT
operation child(childName : String[?]) : Person[?]
{
	body: children->any(c : Person | c.name=childName);
}

works but

operation child(childName : String[?]) : Person[?]
{
	body: children->any(name=childName);
}

doesn't since implicit self is not resolved to the implicit iterator.
Comment 1 Ed Willink CLA 2010-10-23 14:34:42 EDT
Problem seems to involve references to the 'wrong' CS copy. In principle implicit self is handled, but Xtext reparses create multiple CS trees, so the wrong one is easy to use.

Problem will go away once references terminate in the Pivot AST.
Comment 2 Ed Willink CLA 2010-10-23 14:39:44 EDT
The following fails interactively but not as a JUnit test.

package bug328485 : bug = 'http://www.eclipse.org/mdt/ocl/bug328485'
{
	class Bug328485
	{
		property names : Named[*];
		invariant Self: names->any(name = '') = 1;
	}
	class Named
	{
		property name : String;
	}
}
Comment 3 Ed Willink CLA 2012-04-05 16:05:19 EDT
Indeed problem has gone away. Test added.
Comment 4 Ed Willink CLA 2013-05-20 11:38:10 EDT
CLOSED after a year in the RESOLVED state.