Bug 435059 - [Closures] disambiguate type of closure by looking at usage of "self"
Summary: [Closures] disambiguate type of closure by looking at usage of "self"
Status: NEW
Alias: None
Product: Xtend
Classification: Tools
Component: Core (show other bugs)
Version: 2.6.0   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-16 08:56 EDT by Stefan Oehme CLA
Modified: 2014-05-16 08:56 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Oehme CLA 2014-05-16 08:56:27 EDT
This code currently does not compile:

class Test {
	def test() {
		foo[|self.bar]
	}
	
	def foo(Bar bar) {}
	def foo(Baz baz) {}
	
	interface Bar {
		def void bar()
	}
	interface Baz {
		def void baz()
	}
}

The call "foo[|self.bar]" is ambiguous. However, since we only use the "bar" method from the "Bar" interface, there actually is no ambiguity.

This would be useful for some (badly designed) APIs which have heavily overloaded callback methods like "addListener". But it seems pretty hard to do well, so feel free to "WONTFIX" this =)