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,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()
}