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

Bug 352705

Summary: Implicit variable in closure need to error in blocks
Product: [Modeling] TMF Reporter: Benjamin Schwertfeger <benjamin.schwertfeger>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: christian.dietrich.opensource, sebastian.zarnekow
Version: 2.0.1Flags: sebastian.zarnekow: indigo+
Target Milestone: SR1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Benjamin Schwertfeger CLA 2011-07-21 03:55:52 EDT
The following snippet leads to an error in the xtend file if it's added to the domainmodel generator. The first e.name is ok, but the one after after the equals sign is not recognized.

	def void forEachError(Entity p) {
		{
			p.features.forEach(e|{
				e.name=e.name.toFirstLower()
				true
			})
			p
		}
	}

Workaround:
Add the type to the closure:
	def void forallError(Entity p) {
		{
			p.features.forall(Feature e|{
				e.name=e.name.toFirstLower()
				true
			})
			p
		}
	}
Comment 1 Sebastian Zarnekow CLA 2011-07-22 05:43:02 EDT
Pushed to master.
Comment 2 Karsten Thoms CLA 2017-09-19 17:42:15 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 17:53:22 EDT
Closing all bugs that were set to RESOLVED before Neon.0