KT-10752: if (inferred) type for an expression refers to a Java class

non-accessible in the current context, it is a compiler error.
Otherwise we might generate a CHECKCAST instruction that causes IAE at run-time.
Here we are somewhat less permissive then Java
(see inaccessibleType.kt in diagnostics tests).
This commit is contained in:
Dmitry Petrov
2016-01-25 16:45:06 +03:00
parent 1b78d01ae6
commit 112e54b35a
10 changed files with 216 additions and 9 deletions
@@ -30,6 +30,5 @@ package other
import test.My
class Your {
// Ok but dangerous: internal vs package-private in different package
internal fun bar() = My.foo()
internal fun bar() = <!INACCESSIBLE_TYPE!>My.foo()<!>
}