Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328485

Summary: [editor] Incorrect implicit self in iterator
Product: [Modeling] OCL Reporter: Ed Willink <ed>
Component: CoreAssignee: OCL Inbox <mdt-ocl-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 Keywords: plan
Version: 3.0.0   
Target Milestone: M7   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

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.