FIR: handle SAM constructor properly in visibility checker

#KT-46074 Fixed
This commit is contained in:
Mikhail Glukhikh
2021-04-14 09:42:53 +03:00
parent d8a2f82cbd
commit 4c13fe5631
3 changed files with 24 additions and 0 deletions
@@ -5,6 +5,12 @@ FILE: kotlinSam.kt
}
public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| {
}
private abstract interface PrivateRunnable : R|kotlin/Any| {
public abstract fun bar(x: R|kotlin/String|): R|kotlin/Boolean|
}
private final fun bar(pr: R|PrivateRunnable|): R|kotlin/Unit| {
}
public final fun main(): R|kotlin/Unit| {
R|/foo|(R|/MyRunnable|(<L> = MyRunnable@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/Boolean| <inline=NoInline> {
^ CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(Int(1)))
@@ -19,4 +25,8 @@ FILE: kotlinSam.kt
}
R|/foo|(R|/MyRunnable|(R|<local>/x|))
R|/bar|(R|/PrivateRunnable|(<L> = PrivateRunnable@fun <anonymous>(s: R|kotlin/String|): R|kotlin/Boolean| <inline=NoInline> {
^ CMP(>, R|<local>/s|.R|kotlin/String.length|.R|kotlin/Int.compareTo|(Int(0)))
}
))
}
@@ -4,6 +4,12 @@ fun interface MyRunnable {
fun foo(m: MyRunnable) {}
private fun interface PrivateRunnable {
fun bar(x: String): Boolean
}
private fun bar(pr: PrivateRunnable) {}
fun main() {
foo(MyRunnable { x ->
x > 1
@@ -14,4 +20,6 @@ fun main() {
val x = { x: Int -> x > 1 }
foo(MyRunnable(x))
bar(PrivateRunnable { s -> s.length > 0 })
}