Added tests for choosing 'most specific' resolution candidate

Fixed test (while resolve with library on android): 'run' resolves to library function
This commit is contained in:
Svetlana Isakova
2014-07-10 19:00:40 +04:00
parent eca2c7beea
commit fb4c256d08
6 changed files with 78 additions and 3 deletions
@@ -1,11 +1,11 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
<!NO_TAIL_CALLS_FOUND!>tailRecursive fun foo()<!> {
run {
bar {
<!NON_TAIL_RECURSIVE_CALL!>foo<!>()
}
}
fun run(a: Any) {}
fun bar(a: Any) {}
fun box(): String {
foo()
@@ -0,0 +1,8 @@
fun <T> emptyList(): List<T> = throw Exception()
fun <T> doSmth(l: List<T>) {}
fun doSmth(a: Any) {}
fun bar() {
<caret>doSmth(emptyList())
}
@@ -0,0 +1,22 @@
fun <T> emptyList(): List<T> = throw Exception()
fun <T> doSmth(l: List<T>) {}
fun doSmth(a: Any) {}
fun bar() {
<caret>doSmth(emptyList())
}
Resolved call:
Candidate descriptor: fun <T> doSmth(l: List<T>): Unit
Resulting descriptor: fun <T> doSmth(l: List<???>): Unit
Explicit receiver kind = NO_EXPLICIT_RECEIVER
This object = NO_RECEIVER
Receiver argument = NO_RECEIVER
Value arguments mapping:
MATCH_MODULO_UNINFERRED_TYPES l : List<???> = emptyList()
@@ -0,0 +1,6 @@
fun foo() {
<caret>bar { }
}
fun bar(a: Any) = a
fun <T> bar(f: () -> T): T = f()
@@ -0,0 +1,20 @@
fun foo() {
<caret>bar { }
}
fun bar(a: Any) = a
fun <T> bar(f: () -> T): T = f()
Resolved call:
Candidate descriptor: fun <T> bar(f: () -> T): T
Resulting descriptor: fun <T> bar(f: () -> Unit): Unit
Explicit receiver kind = NO_EXPLICIT_RECEIVER
This object = NO_RECEIVER
Receiver argument = NO_RECEIVER
Value arguments mapping:
SUCCESS f : () -> Unit = { }