Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352705 - Implicit variable in closure need to error in blocks
Summary: Implicit variable in closure need to error in blocks
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-21 03:55 EDT by Benjamin Schwertfeger CLA
Modified: 2017-09-19 17:53 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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