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

Bug 370918

Summary: Type conformance not checked
Product: [Tools] Xtend Reporter: Sven Efftinge <sven.efftinge>
Component: CoreAssignee: Project Inbox <xtend-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dennis.huebner, sebastian.zarnekow
Version: 2.3.0Flags: sven.efftinge: kepler+
Target Milestone: M6   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on: 376037    
Bug Blocks:    

Description Sven Efftinge CLA 2012-02-08 04:11:20 EST
Given the following Xtend code:
class XtendClass {
	
	@Test
	def void testMethod() {
		println(newArrayList('foo','bar','baz').toUpperCase)
	}
	
	def toUpperCase(Collection<String> allStrings) {
		allStrings.forEach[toUpperCase]
	}
}

the compiler generates :

  @Test
  public void testMethod() {
    ArrayList<String> _newArrayList = CollectionLiterals.<String>newArrayList("foo", "bar", "baz");
    this.toUpperCase(_newArrayList);
    InputOutput.<void>println(null);
  }

note 'void' is used as type parameter.
Comment 1 Sebastian Zarnekow CLA 2012-02-08 04:16:54 EST
IterableExtensions#forEach returns void thus I'd expect an error marker on the invocation of println
Comment 2 Dennis Huebner CLA 2013-02-14 04:43:26 EST
Fixed in the meanwhile.
Error marker says: Incompatible types. Expected Object but was void