FIR: Fix resolution for invokes on class qualifiers

This commit is contained in:
Denis Zharkov
2020-03-30 13:04:00 +03:00
parent 10531d2874
commit 9abe669443
24 changed files with 173 additions and 104 deletions
@@ -1,39 +0,0 @@
// SKIP_TXT
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +NewInference
fun main() {
Configuration().commands {
<!INAPPLICABLE_CANDIDATE!>Command1<!> { <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>someService<!>::execute<!> } // Overload resolution ambiguity. All these functions match.
<!INAPPLICABLE_CANDIDATE!>Command2<!> { <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>someService<!>::execute<!> } // Overload resolution ambiguity. All these functions match.
<!INAPPLICABLE_CANDIDATE!>Command1<!> { { <!UNRESOLVED_REFERENCE!>someService<!>.<!UNRESOLVED_REFERENCE!>execute<!>(<!UNRESOLVED_REFERENCE!>it<!>) } } // fine
<!INAPPLICABLE_CANDIDATE!>Command2<!> { { <!UNRESOLVED_REFERENCE!>someService<!>.<!UNRESOLVED_REFERENCE!>execute<!>(<!UNRESOLVED_REFERENCE!>it<!>) } } // fine
}
}
interface Command
interface CommandFactory<TCommand : Command>
class Command1 : Command {
companion object : CommandFactory<Command1>
}
class Command2 : Command {
companion object : CommandFactory<Command2>
}
class Configuration {
val commands = Commands()
inline fun commands(configure: Commands.() -> Unit) {
commands.configure()
}
class Commands {
operator fun <TCommand : Command> CommandFactory<TCommand>.invoke(
handler: Transaction.() -> ((command: TCommand) -> Unit)
) {
}
}
}
interface Transaction {
val someService: SomeService
}
interface SomeService {
fun execute(command: Command1)
fun execute(command: Command2)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +NewInference