Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361785 - [xtend] Compiler generates bogus casts in dispatch method body
Summary: [xtend] Compiler generates bogus casts in dispatch method body
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.1.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-24 05:34 EDT by Sebastian Zarnekow CLA
Modified: 2017-09-19 17:34 EDT (History)
0 users

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-10-24 05:34:03 EDT
Try to implement a type provider with xtend:

def dispatch type(XBinaryOperation bo, JvmTypeReference r, boolean b) {
	.. some impl ..
}

the generated code looks like this (formatting is applied manually in this bug report):

public JvmTypeReference type(
	final XExpression binaryOperation,
	final JvmTypeReference rawExpectation,
	final boolean rawType) {
  if ((binaryOperation instanceof XBinaryOperation)) { <-- unnecessary parenthesis
    return _type(
	(XBinaryOperation)binaryOperation, <-- expected cast
	(JvmTypeReference)rawExpectation, <-- unexpected cast
	(Boolean)rawType <-- unnecessary boxing and unboxing due to cast
	); 
  }
..
Comment 1 Sebastian Zarnekow CLA 2011-10-24 16:55:31 EDT
Pushed to master.
Comment 2 Karsten Thoms CLA 2017-09-19 17:23:33 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 17:34:53 EDT
Closing all bugs that were set to RESOLVED before Neon.0