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

Bug 345828

Summary: [xtend] error inferring return type of generic function type reference closure
Product: [Modeling] TMF Reporter: Knut Wannheden <knut.wannheden>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow
Version: 2.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: SR1   
Hardware: All   
OS: All   
Whiteboard:

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