Files
kotlin-fork/compiler/testData/diagnostics/tests/scopes/kt1822.fir.kt
T
Dmitriy Novozhilov c80cfb0fdb [FIR] Replace single supertype scope with list of scopes of supertypes in use site scopes
This big refactoring is needed to cleanup building of overrides
  mappings and prevent creating redundant intersection overrides in
  cases when there is no need in them:

```kotlin
interface A {
    fun foo()
}

interface B {
    fun foo()
}

interface C : A, B {
    override fun foo()
}
```

Before this refactoring there was next override tree:
C.foo
  intersection override (A.foo, B.foo)
    A.foo
    B.foo

Also this commit fixes special mapping of overrides in jvm scopes
  for declarations which have kotlin builtins in supertypes with
  special java mapping rules (collections, for example)
2022-01-19 15:24:43 +03:00

31 lines
608 B
Kotlin
Vendored

//KT-1822 Error 'cannot infer visibility' required
package kt1822
open class C {
internal open fun foo() {}
}
interface T {
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>protected<!> fun foo() {}
}
class G : C(), T {
override fun <!CANNOT_CHANGE_ACCESS_PRIVILEGE!>foo<!>() {} //should be an error "cannot infer visibility"; for now 'public' is inferred in such cases
}
open class A {
internal open fun foo() {}
}
interface B {
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>protected<!> fun foo() {}
}
interface D {
public fun foo() {}
}
class E : A(), B, D {
override fun foo() {}
}