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