Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345828 - [xtend] error inferring return type of generic function type reference closure
Summary: [xtend] error inferring return type of generic function type reference closure
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-14 16:43 EDT by Knut Wannheden CLA
Modified: 2017-09-19 18:08 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 Knut Wannheden CLA 2011-05-14 16:43:44 EDT
The following Xtend2 snippet:

	def <T extends =>Integer> baz(T t) {
		t.apply
	}

is compiled to:

  public <T extends Function0<Integer>> Object baz(final T t) {
    ? _apply = t.apply();
    return _apply;
  }

This Java code has compile errors. The problem seems to be that the type of the expression t.apply() is inferred as Object instead of Integer. It should be compiled to:

  public <T extends Function0<Integer>> Integer baz(final T t) {
    Integer _apply = t.apply();
    return _apply;
  }
Comment 1 Sebastian Zarnekow CLA 2011-07-18 10:23:43 EDT
Pushed to master.
Comment 2 Karsten Thoms CLA 2017-09-19 17:57:26 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 18:08:13 EDT
Closing all bugs that were set to RESOLVED before Neon.0