Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344556 - [xtend] Create function should allow to explicitly define the return type
Summary: [xtend] Create function should allow to explicitly define the return type
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: RC1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-03 08:10 EDT by Sebastian Zarnekow CLA
Modified: 2017-09-19 18:07 EDT (History)
1 user (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 Sebastian Zarnekow CLA 2011-05-03 08:10:35 EDT
Currently the return type is the actual type of the create expression. This may expose implementation detail. A workaround is to use a cast expression but that leads to a too generic type in the initializer expression.

create MyType result: new MyTypeImpl() newMyType(String something) {
  result.setPropertyWhichIsNotInTheInterface(something);
}

This seems a little counter intuitive to me. Another option is:

MyType create result: newTypeImpl(..) newMyType(String something) {
 ..
}

which would be more in line with the definition of other operations.
Comment 1 Sven Efftinge CLA 2011-05-03 09:48:54 EDT
+1 for

MyType create result: newTypeImpl(..) newMyType(String something) {
 ..
}
Comment 2 Sebastian Zarnekow CLA 2011-05-04 05:56:40 EDT
Pushed to master.
Comment 3 Karsten Thoms CLA 2017-09-19 17:56:27 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 18:07:18 EDT
Closing all bugs that were set to RESOLVED before Neon.0