Update test data for compiler visualizer

This commit is contained in:
Ivan Kylchik
2021-02-08 14:06:10 +03:00
committed by TeamCityServer
parent 4ac38e5f29
commit 919591909e
17 changed files with 406 additions and 12 deletions
@@ -0,0 +1,31 @@
private fun resolveAccessorCall(
// [ERROR : PropertyDescriptor]
// │
suspendPropertyDescriptor: PropertyDescriptor,
// [ERROR : TranslationContext]
// │
context: TranslationContext
// [ERROR : ResolvedCall<PropertyDescriptor>]<[ERROR : PropertyDescriptor]>
// │ [ERROR : PropertyDescriptor]
// │ │
): ResolvedCall<PropertyDescriptor> {
// [ERROR : ResolvedCall<PropertyDescriptor>]<[ERROR : PropertyDescriptor]>
// │ [ERROR : PropertyDescriptor]
// │ │
return object : ResolvedCall<PropertyDescriptor> {
// [ERROR : <ERROR PROPERTY TYPE>]
// │ [ERROR: not resolved]
// │ │ [ERROR: not resolved]
// │ │ │
override fun getStatus() = ResolutionStatus.SUCCESS
// [ERROR : PropertyDescriptor]
// │ resolveAccessorCall.suspendPropertyDescriptor: [ERROR : PropertyDescriptor]
// │ │
override fun getCandidateDescriptor() = suspendPropertyDescriptor
// [ERROR : PropertyDescriptor]
// │ resolveAccessorCall.suspendPropertyDescriptor: [ERROR : PropertyDescriptor]
// │ │
override fun getResultingDescriptor() = suspendPropertyDescriptor
}
}
@@ -0,0 +1,16 @@
fun test1(s: String?) contract [returnsNotNull()] {
// [ERROR: not resolved]
// │
contract {
// [ERROR: not resolved]
// │ [ERROR: not resolved]
// │ │ test1.s: String?
// │ │ │ fun (Any).equals(Any?): Boolean
// │ │ │ │ Nothing?
// │ │ │ │ │
returns() implies (s != null)
}
// fun test1(String?): Unit
// │
test1()
}
@@ -0,0 +1,59 @@
// new contracts syntax for property accessors
class MyClass {
// Int Int
// │ │
var myInt: Int = 0
// Int
// │
get() contract [returnsNotNull()] = 1
// Int
// │
set(value) {
// var MyClass.<set-myInt>.field: Int
// │ MyClass.<set-myInt>.value: Int
// │ │ fun (Int).times(Int): Int
// │ │ │ Int
// │ │ │ │
field = value * 10
}
}
class AnotherClass(multiplier: Int) {
// Int Int
// │ │
var anotherInt: Int = 0
// Int
// │
get() contract [returnsNotNull()] = 1
// Int
// │
set(value) contract [returns()] {
// var AnotherClass.<set-anotherInt>.field: Int
// │ AnotherClass.<set-anotherInt>.value: Int
// │ │ [ERROR: not resolved]
// │ │ │ [ERROR: not resolved]
// │ │ │ │
field = value * multiplier
}
}
class SomeClass(multiplier: Int?) {
// Int Int
// │ │
var someInt: Int = 0
// Int
// │
get() contract [returnsNotNull()] = 1
// Int [ERROR: unknown type]
// │ │
set(value) contract [returns() implies (value != null)] {
// SomeClass.<set-someInt>.value: Int
// │ [ERROR: not resolved]
// │ │
value ?: throw NullArgumentException()
// var SomeClass.<set-someInt>.field: Int
// │ SomeClass.<set-someInt>.value: Int
// │ │
field = value
}
}
@@ -0,0 +1,14 @@
// new contracts syntax for simple functions
// [ERROR : MyClass]? [ERROR: unknown type] [ERROR: unknown type]
// │ │ │
fun test1(s: MyClass?) contract [returns() implies (s != null), returns() implies (s is MySubClass)] {
// [ERROR: not resolved]
// │
test_1()
}
fun test2() contract [returnsNotNull()] {
// fun test2(): Unit
// │
test2()
}
@@ -0,0 +1,125 @@
// Should have raw description
fun test_1() {
// [ERROR: not resolved]
// │
contract {
// [ERROR: not resolved]
// │
callsInPlace()
}
// fun test_1(): Unit
// │
test_1()
}
fun test_2() {
// fun contracts/contract(contracts/ContractBuilder.() -> Unit): Unit
// package kotlin │ contract@0
// │ │ │
kotlin.contracts.contract {
// this@0
// fun <R> (contracts/ContractBuilder).callsInPlace<???>(Function<???>, contracts/InvocationKind = ...): contracts/CallsInPlace
// │
callsInPlace()
// this@0
// fun <R> (contracts/ContractBuilder).callsInPlace<???>(Function<???>, contracts/InvocationKind = ...): contracts/CallsInPlace
// │
callsInPlace()
}
// fun test_2(): Unit
// │
test_2()
}
// Int Int
// │ │
var test_3: Int = 1
get() {
// [ERROR: not resolved]
// │
contract {
// [ERROR: not resolved]
// │
callsInPlace()
}
// Int
// │
return 1
}
// Int
// │
set(value) {
// fun contracts/contract(contracts/ContractBuilder.() -> Unit): Unit
// package kotlin │ contract@0
// │ │ │
kotlin.contracts.contract {
// this@0
// fun <R> (contracts/ContractBuilder).callsInPlace<???>(Function<???>, contracts/InvocationKind = ...): contracts/CallsInPlace
// │
callsInPlace()
// this@0
// fun <R> (contracts/ContractBuilder).callsInPlace<???>(Function<???>, contracts/InvocationKind = ...): contracts/CallsInPlace
// │
callsInPlace()
}
}
fun test_4() {
// [ERROR: not resolved]
// │
contract()
// fun test_4(): Unit
// │
test_4()
}
// should not have raw description
fun test_5() {
// fun test_5(): Unit
// │
test_5()
// [ERROR: not resolved]
// │
contract()
}
fun test_6() {
// [ERROR: not resolved]
// │ [ERROR: not resolved]
// │ │ [ERROR: not resolved]
// │ │ │ [ERROR: not resolved]
// │ │ │ │
aaa.bbb.ccc.contract {
}
// fun test_6(): Unit
// │
test_6()
}
fun test_7() {
// [ERROR: not resolved]
// │ [ERROR: not resolved]
// │ │
contracts.contract {
}
// fun test_7(): Unit
// │
test_7()
}
fun test_8() {
// [ERROR: not resolved]
// │ [ERROR: not resolved]
// │ │ [ERROR: not resolved]
// │ │ │ [ERROR: not resolved]
// │ │ │ │
aaa.kotlin.contracts.contract {
}
// fun test_8(): Unit
// │
test_8()
}
@@ -0,0 +1,35 @@
// package kotlin
// │
import kotlin.properties.ReadWriteProperty
// package kotlin
// │
import kotlin.reflect.KProperty
// fun <T> lazy<Int>(() -> Int): Lazy<Int>
// │ Int
// │ │ fun (Int).plus(Int): Int
// Int │ │ │ Int
// │ │ │ │ │
val x: Int by lazy { 1 + 2 }
// properties/ReadWriteProperty<Any?, Int>
// │ properties/ReadWriteProperty<Any?, Int>
// │ │
val delegate = object: ReadWriteProperty<Any?, Int> {
// reflect/KProperty<*>
// │ Int
// │ │ Int
// │ │ │
override fun getValue(thisRef: Any?, property: KProperty<*>): Int = 1
// reflect/KProperty<*>
// │
override fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {}
}
// Int val delegate: properties/ReadWriteProperty<Any?, Int>
// │ │
val value by delegate
// Int val delegate: properties/ReadWriteProperty<Any?, Int>
// │ │
var variable by delegate
@@ -0,0 +1,5 @@
fun test() {
// test.<no name provided>
// │
val x = object {}
}
@@ -61,3 +61,22 @@ enum class Planet(val m: Double, internal val r: Double) {
const val G = 6.67e-11
}
}
enum class PseudoInsn(val signature: String = "()V") {
FIX_STACK_BEFORE_JUMP,
// constructor PseudoInsn(String = ...)
// │
FAKE_ALWAYS_TRUE_IFEQ("()I"),
// constructor PseudoInsn(String = ...)
// │
FAKE_ALWAYS_FALSE_IFEQ("()I"),
SAVE_STACK_BEFORE_TRY,
RESTORE_STACK_IN_TRY_CATCH,
STORE_NOT_NULL,
// constructor PseudoInsn(String = ...)
// │
AS_NOT_NULL("(Ljava/lang/Object;)Ljava/lang/Object;")
;
fun emit() {}
}
@@ -0,0 +1,24 @@
external class External
external fun foo(): String
// Int
// │
external val x: Int
class NotExternal {
external fun bar(): String
// Int
// │
var y: Int
external get
// Int
// │
set(value) {}
}
// Int
// │
var z: Int
external get
external set
@@ -1,5 +1,4 @@
// FIR_IGNORE
interface Any
// T?