Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discriminate overload resolution candidates which require (SAM) conversions #95

Open
ice-phoenix opened this issue Sep 9, 2021 · 1 comment
Labels

Comments

@ice-phoenix
Copy link
Contributor

Exhibit 1:

package foo

fun interface Callback {
    fun doit(): Unit
}

fun foo(cb: () -> Unit) {} // (1)
fun foo(cb: Callback) {} // (2)

fun test() {
    foo {} // resolved to (1)
}

Exhibit 2:

package foo

fun ambiguous(sfn: suspend () -> Unit) = sfn // (1)
fun ambiguous(fn: () -> Unit) = fn // (2)

fun test(fn: () -> Unit) = ambiguous(fn) // resolved to (2)
// Note: this will need fixing after the compatibility mode disabling

Some additional info available at Quip (Disabling new inference compatibility mode).

@ice-phoenix ice-phoenix added the bug label Sep 9, 2021
@ice-phoenix
Copy link
Contributor Author

ice-phoenix commented Sep 9, 2021

Probably this needs to be postponed for after a more complete SAM conversion design w.r.t. overload resolution is achieved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant