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:
+37
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user