Files
kotlin-fork/compiler/testData/diagnostics/tests/regressions/kt9682.kt
T
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00

29 lines
463 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.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!>() // should be ambiguity
}