Use 'run' function instead of 'synchronized' in KT-51036 test

It should be enough to reproduce the issue and makes the test runnable on all backends
This commit is contained in:
Ilya Gorbunov
2023-04-26 14:20:18 +02:00
committed by Space Team
parent 92a7a74382
commit 568d4b11af
4 changed files with 5 additions and 74 deletions
+1 -6
View File
@@ -1,8 +1,4 @@
// WITH_STDLIB
// IGNORE_BACKEND: WASM
// ^ Unresolved reference: synchronized
// IGNORE_BACKEND: NATIVE
// ^ Unresolved reference: synchronized
fun box(): String {
A().close()
@@ -12,6 +8,5 @@ fun box(): String {
class A {
companion object;
operator fun String.invoke() = Unit
@Suppress("DEPRECATION_ERROR")
fun close() = synchronized(this) { "abc" }()
fun close() = kotlin.run { "abc" }()
}
@@ -1,61 +0,0 @@
FILE fqName:<root> fileName:/kt51036.kt
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.Companion
CONSTRUCTOR visibility:private <> () returnType:<root>.A.Companion [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:invoke visibility:public modality:FINAL <> ($this:<root>.A, $receiver:kotlin.String) returnType:kotlin.Unit [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.A
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun invoke (): kotlin.Unit [operator] declared in <root>.A'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
FUN name:close visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Unit
annotations:
Suppress(names = ['DEPRECATION_ERROR'])
$this: VALUE_PARAMETER name:<this> type:<root>.A
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun close (): kotlin.Unit declared in <root>.A'
CALL 'public final fun invoke (): kotlin.Unit [operator] declared in <root>.A' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A.close' type=<root>.A origin=null
$receiver: CALL 'public final fun synchronized <R> (lock: kotlin.Any, block: kotlin.Function0<R of kotlin.StandardKt.synchronized>): R of kotlin.StandardKt.synchronized [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null
<R>: kotlin.String
lock: GET_VAR '<this>: <root>.A declared in <root>.A.close' type=<root>.A origin=null
block: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.A.close'
CONST String type=kotlin.String value="Abc"
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
+2 -5
View File
@@ -31,16 +31,13 @@ FILE fqName:<root> fileName:/kt51036.kt
RETURN type=kotlin.Nothing from='public final fun invoke (): kotlin.Unit [operator] declared in <root>.A'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
FUN name:close visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Unit
annotations:
Suppress(names = ['DEPRECATION_ERROR'])
$this: VALUE_PARAMETER name:<this> type:<root>.A
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun close (): kotlin.Unit declared in <root>.A'
CALL 'public final fun invoke (): kotlin.Unit [operator] declared in <root>.A' type=kotlin.Unit origin=INVOKE
CALL 'public final fun invoke (): kotlin.Unit [operator] declared in <root>.A' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A.close' type=<root>.A origin=null
$receiver: CALL 'public final fun synchronized <R> (lock: kotlin.Any, block: kotlin.Function0<R of kotlin.StandardKt.synchronized>): R of kotlin.StandardKt.synchronized [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null
$receiver: CALL 'public final fun run <R> (block: kotlin.Function0<R of kotlin.StandardKt.run>): R of kotlin.StandardKt.run [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null
<R>: kotlin.String
lock: GET_VAR '<this>: <root>.A declared in <root>.A.close' type=<root>.A origin=null
block: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
+2 -2
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// WITH_STDLIB
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
@@ -6,6 +7,5 @@
class A {
companion object;
operator fun String.invoke() = Unit
@Suppress("DEPRECATION_ERROR")
fun close() = synchronized(this) { "Abc" }()
fun close() = kotlin.run { "Abc" }()
}