Files
Denis Zharkov 47ecaa5b06 FIR: Fix scope intersection types
Otherwise overload resolution ambiguity is reported in the test
2020-01-30 17:12:50 +03:00

29 lines
427 B
Kotlin
Vendored

// KT-9682 Overload Resolution Ambiguity after casting to Interface
open class Foo {
fun bar(): Foo {
return this
}
}
class Foo2 : Foo(), IFoo
interface IFoo {
fun bar(): Foo
}
fun test() {
val foo : Foo = Foo2()
foo as IFoo
foo.bar() // Should be resolved to Foo#bar
}
interface IFoo2 {
fun bar(): IFoo2
}
fun test2(foo: Foo) {
foo as IFoo2
foo.bar() // should be ambiguity
}