Fixed bug with property and function name clash.

Complete type inference dependent on function literals and expected type
for variable as function calls not for 'invoke' calls
This commit is contained in:
svtk
2013-11-25 18:50:58 +04:00
parent f939918d36
commit 95ca2d8f98
4 changed files with 49 additions and 3 deletions
@@ -0,0 +1,37 @@
package d
import java.util.ArrayList
fun box(): String {
ListTag().test(listOf("a", "b"))
return "OK"
}
fun ListTag.test(list: List<String>) {
for (item in list) {
item() {
a {
text = item
}
}
}
}
open class HtmlTag
open class ListTag : HtmlTag() {}
class LI : ListTag() {}
public fun ListTag.item(body: LI.() -> Unit): Unit {}
fun HtmlTag.a(contents: A.() -> Unit) {}
trait A : HtmlTag {
public var text: String
}
fun listOf(vararg strings: String): List<String> {
val list = ArrayList<String>()
for (s in strings) {
list.add(s)
}
return list
}