Fixed tests after adding error checking for intention tests.

This commit is contained in:
Zalim Bashorov
2014-04-01 20:49:24 +04:00
parent 8d19c7309b
commit b43958f4b3
399 changed files with 1376 additions and 906 deletions
@@ -1,4 +1,6 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
<caret>do println("test") <caret>do doSomething("test")
while(true) while(true)
} }
@@ -1,5 +1,7 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
do { do {
println("test") doSomething("test")
} while(true) } while(true)
} }
@@ -1,4 +1,6 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
if (true) println("test") if (true) doSomething("test")
<caret>else println("test2") <caret>else doSomething("test2")
} }
@@ -1,6 +1,8 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
if (true) println("test") if (true) doSomething("test")
else { else {
println("test2") doSomething("test2")
} }
} }
@@ -1,4 +1,6 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
for (i in 1..4) for (i in 1..4)
<caret>println("test") <caret>doSomething("test")
} }
@@ -1,5 +1,7 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
for (i in 1..4) { for (i in 1..4) {
println("test") doSomething("test")
} }
} }
@@ -1,3 +1,5 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
<caret>if (true) println("test") else println("test2") <caret>if (true) doSomething("test") else doSomething("test2")
} }
@@ -1,5 +1,7 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
if (true) { if (true) {
println("test") doSomething("test")
} else println("test2") } else doSomething("test2")
} }
@@ -1,3 +1,5 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
<caret>if (true)println("test") <caret>if (true) doSomething("test")
} }
@@ -1,5 +1,7 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
if (true) { if (true) {
println("test") doSomething("test")
} }
} }
@@ -1,3 +1,5 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
<caret>if (true) println("test"); <caret>if (true) doSomething("test");
} }
@@ -1,5 +1,7 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
if (true) { if (true) {
println("test") doSomething("test")
} }
} }
@@ -1,4 +1,6 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
<caret>while (true) <caret>while (true)
println("test") doSomething("test")
} }
@@ -1,5 +1,7 @@
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
while (true) { while (true) {
println("test") doSomething("test")
} }
} }
@@ -1,6 +1,9 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun foo() { fun foo() {
<caret>if (true) { <caret>if (true) {
println("test") doSomething("test")
} }
} }
@@ -1,7 +1,9 @@
fun doSomething<T>(a: T) {}
fun test() { fun test() {
class Test{ class Test{
fun contains(a: Int) : Boolean = true fun contains(a: Int) : Boolean = true
} }
val test = Test() val test = Test()
println(test.c<caret>ontains(0).toString()) doSomething(test.c<caret>ontains(0).toString())
} }
@@ -1,7 +1,9 @@
fun doSomething<T>(a: T) {}
fun test() { fun test() {
class Test{ class Test{
fun contains(a: Int) : Boolean = true fun contains(a: Int) : Boolean = true
} }
val test = Test() val test = Test()
println((0 in test).toString()) doSomething((0 in test).toString())
} }
@@ -1,7 +1,9 @@
fun doSomething<T>(a: T) {}
fun test() { fun test() {
class Test{ class Test{
fun contains(fn: () -> Boolean) : Boolean = true fun contains(fn: () -> Boolean) : Boolean = true
} }
val test = Test() val test = Test()
println(test.c<caret>ontains { true }.toString()) doSomething(test.c<caret>ontains { true }.toString())
} }
@@ -1,7 +1,9 @@
fun doSomething<T>(a: T) {}
fun test() { fun test() {
class Test{ class Test{
fun contains(fn: () -> Boolean) : Boolean = true fun contains(fn: () -> Boolean) : Boolean = true
} }
val test = Test() val test = Test()
println(({ true } in test).toString()) doSomething(({ true } in test).toString())
} }
@@ -1,4 +1,5 @@
// SHOULD_FAIL_WITH: invalid.arguments // SHOULD_FAIL_WITH: invalid.arguments
// ERROR: Cannot find a parameter with this name: c
fun test() { fun test() {
class Test{ class Test{
fun contains(a: Int=1, b: Int=2): Boolean = true fun contains(a: Int=1, b: Int=2): Boolean = true
@@ -1,4 +1,5 @@
// SHOULD_FAIL_WITH: duplicate.or.missing.arguments // SHOULD_FAIL_WITH: duplicate.or.missing.arguments
// ERROR: No value passed for parameter b
fun test() { fun test() {
class Test{ class Test{
fun contains(a: Int, b: Int): Boolean = true fun contains(a: Int, b: Int): Boolean = true
@@ -1,4 +1,6 @@
// SHOULD_FAIL_WITH: duplicate.or.missing.arguments // SHOULD_FAIL_WITH: duplicate.or.missing.arguments
// ERROR: An argument is already passed for this parameter
// ERROR: No value passed for parameter b
fun test() { fun test() {
class Test{ class Test{
fun get(a: Int, b: Int) : Int = 0 fun get(a: Int, b: Int) : Int = 0
@@ -1,4 +1,5 @@
// SHOULD_FAIL_WITH: invalid.arguments // SHOULD_FAIL_WITH: invalid.arguments
// ERROR: Cannot find a parameter with this name: c
fun test() { fun test() {
class Test{ class Test{
fun get(a: Int=1, b: Int=2) : Int = 0 fun get(a: Int=1, b: Int=2) : Int = 0
@@ -1,4 +1,5 @@
// SHOULD_FAIL_WITH: duplicate.or.missing.arguments // SHOULD_FAIL_WITH: duplicate.or.missing.arguments
// ERROR: No value passed for parameter b
fun test() { fun test() {
class Test{ class Test{
fun get(a: Int, b: Int) : Int = 0 fun get(a: Int, b: Int) : Int = 0
@@ -1,9 +1,9 @@
fun test() { fun test() {
class Test{ class Test{
fun get(a: Int, b: Int, c: Int = 1, d: Int = 1 fn: (i: Int) -> Int) : Int = 0 fun get(a: Int, b: Int, c: Int = 1, d: Int = 1, fn: (i: Int) -> Int) : Int = 0
} }
val test = Test() val test = Test()
test.g<caret>et(1, c=3, b=2) { i -> test.g<caret>et(a=1, c=3, b=2, d=4) { i ->
i i
} }
} }
@@ -1,9 +1,9 @@
fun test() { fun test() {
class Test{ class Test{
fun get(a: Int, b: Int, c: Int = 1, d: Int = 1 fn: (i: Int) -> Int) : Int = 0 fun get(a: Int, b: Int, c: Int = 1, d: Int = 1, fn: (i: Int) -> Int) : Int = 0
} }
val test = Test() val test = Test()
test[1, 2, 3, { i -> test[1, 2, 3, 4, { i ->
i i
}] }]
} }
@@ -1,4 +1,5 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
// ERROR: Unresolved reference: got
fun test() { fun test() {
class Test{ class Test{
fun get(i: Int) : Int = 0 fun get(i: Int) : Int = 0
@@ -1,7 +1,9 @@
fun doSomething<T>(a: T) {}
fun test() { fun test() {
class Test { class Test {
fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test" fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test"
} }
val test = Test() val test = Test()
println(test.i<caret>nvoke(1, "a", "b") { }) doSomething(test.i<caret>nvoke(1, "a", "b") { })
} }
@@ -1,7 +1,9 @@
fun doSomething<T>(a: T) {}
fun test() { fun test() {
class Test { class Test {
fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test" fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test"
} }
val test = Test() val test = Test()
println(test(1, "a", "b") { }) doSomething(test(1, "a", "b") { })
} }
@@ -1,3 +1,5 @@
fun doSomething<T>(a: T) {}
fun test() { fun test() {
class Test { class Test {
fun plus(): Test = Test() fun plus(): Test = Test()
@@ -5,5 +7,5 @@ fun test() {
fun minus(): Test = Test() fun minus(): Test = Test()
} }
val test = Test() val test = Test()
println(-(test + test).pl<caret>us().toString()) doSomething((-((test + test).pl<caret>us())).toString())
} }
@@ -1,3 +1,5 @@
fun doSomething<T>(a: T) {}
fun test() { fun test() {
class Test { class Test {
fun plus(): Test = Test() fun plus(): Test = Test()
@@ -5,5 +7,5 @@ fun test() {
fun minus(): Test = Test() fun minus(): Test = Test()
} }
val test = Test() val test = Test()
println(-(+(test + test)).toString()) doSomething((-(+(test + test))).toString())
} }
@@ -1,10 +1,8 @@
fun foo(): String? { fun foo(): String? {
print("foo")
return "foo" return "foo"
} }
fun bar() { fun bar() {
print("bar")
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
@@ -1,10 +1,8 @@
fun foo(): String? { fun foo(): String? {
print("foo")
return "foo" return "foo"
} }
fun bar() { fun bar() {
print("bar")
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
@@ -1,10 +1,8 @@
fun foo(): String? { fun foo(): String? {
print("foo")
return "foo" return "foo"
} }
fun bar() { fun bar() {
print("bar")
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
@@ -1,10 +1,8 @@
fun foo(): String? { fun foo(): String? {
print("foo")
return "foo" return "foo"
} }
fun bar() { fun bar() {
print("bar")
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
@@ -1,21 +1,23 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
if (n == 1) { if (n == 1) {
<caret>if (3 > 2) { <caret>if (3 > 2) {
println("***") doSomething("***")
res = "one" res = "one"
} else { } else {
println("***") doSomething("***")
res = "???" res = "???"
} }
} else if (n == 2) { } else if (n == 2) {
println("***") doSomething("***")
res = "two" res = "two"
} else { } else {
println("***") doSomething("***")
res = "too many" res = "too many"
} }
return res return res
} }
@@ -1,21 +1,23 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
if (n == 1) { if (n == 1) {
<caret>res = if (3 > 2) { <caret>res = if (3 > 2) {
println("***") doSomething("***")
"one" "one"
} else { } else {
println("***") doSomething("***")
"???" "???"
} }
} else if (n == 2) { } else if (n == 2) {
println("***") doSomething("***")
res = "two" res = "two"
} else { } else {
println("***") doSomething("***")
res = "too many" res = "too many"
} }
return res return res
} }
@@ -1,13 +1,15 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
<caret>if (n == 1) { <caret>if (n == 1) {
println("***") doSomething("***")
res = "one" res = "one"
} else { } else {
println("***") doSomething("***")
res = "two" res = "two"
} }
return res return res
} }
@@ -1,13 +1,15 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
<caret>res = if (n == 1) { <caret>res = if (n == 1) {
println("***") doSomething("***")
"one" "one"
} else { } else {
println("***") doSomething("***")
"two" "two"
} }
return res return res
} }
@@ -1,16 +1,18 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String = "" var res: String = ""
<caret>if (n == 1) { <caret>if (n == 1) {
println("***") doSomething("***")
res = "one" res = "one"
} else { } else {
var res: String var res: String
println("***") doSomething("***")
res = "two" res = "two"
} }
return res return res
} }
@@ -1,11 +1,13 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String = "" var res: String = ""
<caret>if (n == 1) { <caret>if (n == 1) {
println("***") doSomething("***")
res = "one" res = "one"
} }
return res return res
} }
@@ -1,14 +1,16 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
<caret>if (n == 1) { <caret>if (n == 1) {
res = "one" res = "one"
println("***") doSomething("***")
} else { } else {
println("***") doSomething("***")
res = "two" res = "two"
} }
return res return res
} }
@@ -1,17 +1,19 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
if (n == 1) { if (n == 1) {
<caret>if (3 > 2) { <caret>if (3 > 2) {
println("***") doSomething("***")
return "one" return "one"
} else { } else {
println("***") doSomething("***")
return "???" return "???"
} }
} else if (n == 2) { } else if (n == 2) {
println("***") doSomething("***")
return "two" return "two"
} else { } else {
println("***") doSomething("***")
return "too many" return "too many"
} }
} }
@@ -1,17 +1,19 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
if (n == 1) { if (n == 1) {
<caret>return if (3 > 2) { <caret>return if (3 > 2) {
println("***") doSomething("***")
"one" "one"
} else { } else {
println("***") doSomething("***")
"???" "???"
} }
} else if (n == 2) { } else if (n == 2) {
println("***") doSomething("***")
return "two" return "two"
} else { } else {
println("***") doSomething("***")
return "too many" return "too many"
} }
} }
@@ -1,9 +1,11 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
<caret>if (n == 1) { <caret>if (n == 1) {
println("***") doSomething("***")
return "one" return "one"
} else { } else {
println("***") doSomething("***")
return "two" return "two"
} }
} }
@@ -1,9 +1,11 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
<caret>return if (n == 1) { <caret>return if (n == 1) {
println("***") doSomething("***")
"one" "one"
} else { } else {
println("***") doSomething("***")
"two" "two"
} }
} }
@@ -1,7 +1,9 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
<caret>if (n == 1) { <caret>if (n == 1) {
println("***") doSomething("***")
return "one" return "one"
} }
return "two" return "two"
} }
@@ -1,6 +1,8 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
<caret>return if (n == 1) { <caret>return if (n == 1) {
println("***") doSomething("***")
"one" "one"
} else "two" } else "two"
} }
@@ -1,21 +1,23 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
if (3 > 2) { if (3 > 2) {
<caret>when(n) { <caret>when(n) {
1 -> { 1 -> {
println("***") doSomething("***")
res = "one" res = "one"
} }
else -> { else -> {
println("***") doSomething("***")
res = "two" res = "two"
} }
} }
} else { } else {
println("***") doSomething("***")
res = "???" res = "???"
} }
return res return res
} }
@@ -1,21 +1,23 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
if (3 > 2) { if (3 > 2) {
<caret>res = when(n) { <caret>res = when(n) {
1 -> { 1 -> {
println("***") doSomething("***")
"one" "one"
} }
else -> { else -> {
println("***") doSomething("***")
"two" "two"
} }
} }
} else { } else {
println("***") doSomething("***")
res = "???" res = "???"
} }
return res return res
} }
@@ -1,16 +1,18 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
<caret>when (n) { <caret>when (n) {
1 -> { 1 -> {
println("***") doSomething("***")
res = "one" res = "one"
} }
else -> { else -> {
println("***") doSomething("***")
res = "two" res = "two"
} }
} }
return res return res
} }
@@ -1,16 +1,18 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
<caret>res = when (n) { <caret>res = when (n) {
1 -> { 1 -> {
println("***") doSomething("***")
"one" "one"
} }
else -> { else -> {
println("***") doSomething("***")
"two" "two"
} }
} }
return res return res
} }
@@ -1,19 +1,21 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String = "" var res: String = ""
<caret>when (n) { <caret>when (n) {
1 -> { 1 -> {
println("***") doSomething("***")
res = "one" res = "one"
} }
else -> { else -> {
var res: String var res: String
res = "two" res = "two"
println("***") doSomething("***")
} }
} }
return res return res
} }
@@ -1,18 +1,20 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String = "" var res: String = ""
var res2: String = "" var res2: String = ""
<caret>when (n) { <caret>when (n) {
1 -> { 1 -> {
println("***") doSomething("***")
res = "one" res = "one"
} }
else -> { else -> {
println("***") doSomething("***")
res2 = "two" res2 = "two"
} }
} }
return res + res2 return res + res2
} }
@@ -1,17 +1,19 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
var res: String var res: String
<caret>when (n) { <caret>when (n) {
1 -> { 1 -> {
println("***") doSomething("***")
res = "one" res = "one"
} }
else -> { else -> {
res = "two" res = "two"
println("***") doSomething("***")
} }
} }
return res return res
} }
@@ -1,3 +1,5 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
if (3 > 2) { if (3 > 2) {
<caret>when (n) { <caret>when (n) {
@@ -5,7 +7,7 @@ fun test(n: Int): String {
else -> return "two" else -> return "two"
} }
} else { } else {
println("***") doSomething("***")
return "???" return "???"
} }
} }
@@ -1,3 +1,5 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
if (3 > 2) { if (3 > 2) {
<caret>return when (n) { <caret>return when (n) {
@@ -5,7 +7,7 @@ fun test(n: Int): String {
else -> "two" else -> "two"
} }
} else { } else {
println("***") doSomething("***")
return "???" return "???"
} }
} }
@@ -1,12 +1,14 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
<caret>when(n) { <caret>when(n) {
1 -> { 1 -> {
println("***") doSomething("***")
return "one" return "one"
} }
else -> { else -> {
println("***") doSomething("***")
return "two" return "two"
} }
} }
} }
@@ -1,12 +1,14 @@
fun doSomething<T>(a: T) {}
fun test(n: Int): String { fun test(n: Int): String {
<caret>return when(n) { <caret>return when(n) {
1 -> { 1 -> {
println("***") doSomething("***")
"one" "one"
} }
else -> { else -> {
println("***") doSomething("***")
"two" "two"
} }
} }
} }
@@ -1,10 +1,12 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo: String? = null val foo: String? = null
val bar = "bar" val bar = "bar"
if (foo != null<caret>) { if (foo != null<caret>) {
print ("Hello") doSomething ("Hello")
foo foo
} }
else { else {
@@ -1,4 +1,6 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun <T> T.compareTo(a: T): Int = 0
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = null val foo = null
val bar = "bar" val bar = "bar"
@@ -1,4 +1,8 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>kotlin.Boolean</td></tr><tr><td>Found:</td><td>kotlin.Int</td></tr></table></html>
// ERROR: Condition must be of type kotlin.Boolean, but is of type kotlin.Int
// ERROR: Infix call corresponds to a dot-qualified call 'foo.times(10)' which is not allowed on a nullable receiver 'foo'. Use ?.-qualified call instead
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo: Int? = 4 val foo: Int? = 4
val bar = 3 val bar = 3
@@ -1,10 +1,12 @@
fun doSomething<T>(a: T) {}
fun maybeFoo(): String? { fun maybeFoo(): String? {
return "foo" return "foo"
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
print(foo) doSomething(foo)
val bar = "bar" val bar = "bar"
if (foo != null<caret>) { if (foo != null<caret>) {
foo foo
@@ -1,10 +1,12 @@
fun doSomething<T>(a: T) {}
fun maybeFoo(): String? { fun maybeFoo(): String? {
return "foo" return "foo"
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
print(foo) doSomething(foo)
val bar = "bar" val bar = "bar"
foo ?: bar foo ?: bar
} }
@@ -1,4 +1,6 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>kotlin.Boolean</td></tr><tr><td>Found:</td><td>() &rarr; kotlin.String?</td></tr></table></html>
// ERROR: Condition must be of type kotlin.Boolean, but is of type () -> kotlin.String?
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo: String? = "foo" val foo: String? = "foo"
val bar = "bar" val bar = "bar"
@@ -1,4 +1,6 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo: String? = null val foo: String? = null
val bar = "bar" val bar = "bar"
@@ -7,7 +9,7 @@ fun main(args: Array<String>) {
foo foo
} }
else { else {
print ("Hello") doSomething("Hello")
bar bar
} }
} }
@@ -1,8 +1,10 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo: String? = "abc" val foo: String? = "abc"
if (foo != null<caret>) { if (foo != null<caret>) {
print ("Hello") doSomething ("Hello")
foo.length foo.length
} }
else null else null
@@ -3,7 +3,7 @@ fun main(args: Array<String>) {
var foo: String? = "foo" var foo: String? = "foo"
var bar: String? = "bar" var bar: String? = "bar"
if (foo != null<caret>) { if (foo != null<caret>) {
bar.length bar?.length
} }
else null else null
} }
@@ -1,4 +1,6 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun <T> T.compareTo(a: T): Int = 0
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = "foo" val foo = "foo"
if (foo > null<caret>) { if (foo > null<caret>) {
@@ -1,4 +1,6 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun String?.times(a: Int): Boolean = a == 0
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo: String = "foo" val foo: String = "foo"
if (foo * 10<caret>) { if (foo * 10<caret>) {
@@ -2,11 +2,13 @@ fun maybeFoo(): String? {
return "foo" return "foo"
} }
fun doSomething<T>(a: T) {}
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
print(foo) doSomething(foo)
if (foo != null<caret>) { if (foo != null<caret>) {
foo.length() foo.length
} }
else { else {
null null
@@ -2,8 +2,10 @@ fun maybeFoo(): String? {
return "foo" return "foo"
} }
fun doSomething<T>(a: T) {}
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
print(foo) doSomething(foo)
foo?.length() foo?.length
} }
@@ -6,7 +6,7 @@ val x = maybeFoo()
fun main(args: Array<String>) { fun main(args: Array<String>) {
if (x !=<caret> null) { if (x !=<caret> null) {
x.length() x.length
} else { } else {
null null
} }
@@ -5,5 +5,5 @@ fun maybeFoo(): String? {
val x = maybeFoo() val x = maybeFoo()
fun main(args: Array<String>) { fun main(args: Array<String>) {
x?.length() x?.length
} }
@@ -7,6 +7,6 @@ fun main(args: Array<String>) {
if (foo == null<caret>) { if (foo == null<caret>) {
} }
else { else {
foo.length() foo.length
} }
} }
@@ -3,5 +3,5 @@ fun maybeFoo(): String? {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
maybeFoo()?.length() maybeFoo()?.length
} }
@@ -5,7 +5,7 @@ fun maybeFoo(): String? {
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
if (foo != null<caret>) { if (foo != null<caret>) {
foo.length() foo.length
} }
else { else {
null null
@@ -3,5 +3,5 @@ fun maybeFoo(): String? {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
maybeFoo()?.length() maybeFoo()?.length
} }
@@ -5,7 +5,7 @@ fun maybeFoo(): String? {
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
if (foo != null<caret>) if (foo != null<caret>)
foo.length() foo.length
else else
null null
} }
@@ -3,5 +3,5 @@ fun maybeFoo(): String? {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
maybeFoo()?.length() maybeFoo()?.length
} }
@@ -7,5 +7,5 @@ fun main(args: Array<String>) {
if (foo == null<caret>) if (foo == null<caret>)
null null
else else
foo.length() foo.length
} }
@@ -3,5 +3,5 @@ fun maybeFoo(): String? {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
maybeFoo()?.length() maybeFoo()?.length
} }
@@ -5,7 +5,7 @@ fun maybeFoo(): String? {
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
if (foo != null<caret>) if (foo != null<caret>)
foo.length() foo.length
else else
null null
} }
@@ -3,5 +3,5 @@ fun maybeFoo(): String? {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
maybeFoo()?.length() maybeFoo()?.length
} }
@@ -1,7 +1,10 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>kotlin.Boolean</td></tr><tr><td>Found:</td><td>() &rarr; kotlin.Int</td></tr></table></html>
// ERROR: Condition must be of type kotlin.Boolean, but is of type () -> kotlin.Int
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.String?
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo: String? = "foo" val foo: String? = "foo"
if<caret> { if<caret> {
foo.length() foo.length
} else null } else null
} }
@@ -5,6 +5,6 @@ fun maybeFoo(): String? {
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
if (foo != null<caret>) { if (foo != null<caret>) {
foo.length() foo.length
} }
} }
@@ -3,5 +3,5 @@ fun maybeFoo(): String? {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
maybeFoo()?.length() maybeFoo()?.length
} }
@@ -3,7 +3,7 @@ fun main(args: Array<String>) {
val foo: String? = "foo" val foo: String? = "foo"
val bar: String? = null val bar: String? = null
if (foo == bar<caret>) { if (foo == bar<caret>) {
foo.length() foo?.length
} }
else null else null
} }
@@ -3,7 +3,7 @@ fun main(args: Array<String>) {
val foo: String? = "foo" val foo: String? = "foo"
val bar: String? = null val bar: String? = null
if (foo == bar<caret>) { if (foo == bar<caret>) {
bar.length() bar?.length
} }
else null else null
} }
@@ -5,6 +5,6 @@ fun maybeFoo(): String? {
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
if (foo == null<caret>) else { if (foo == null<caret>) else {
foo.length() foo.length
} }
} }
@@ -3,5 +3,5 @@ fun maybeFoo(): String? {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
maybeFoo()?.length() maybeFoo()?.length
} }
@@ -7,5 +7,5 @@ fun main(args: Array<String>) {
if (maybeFoo() == null<caret>) if (maybeFoo() == null<caret>)
null null
else else
maybeFoo().length() maybeFoo()?.length
} }
@@ -8,5 +8,5 @@ fun main(args: Array<String>) {
if (foo == null<caret>) if (foo == null<caret>)
null null
else else
foo.length() foo?.length
} }
@@ -1,11 +1,13 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun doSomething<T>(a: T) {}
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo: String? = "abc" val foo: String? = "abc"
if (foo != null<caret>) { if (foo != null<caret>) {
foo.length foo.length
} }
else { else {
print("Hi") doSomething("Hi")
null null
} }
} }
@@ -7,5 +7,5 @@ fun main(args: Array<String>) {
if (null == foo<caret>) if (null == foo<caret>)
null null
else else
foo.length() foo.length
} }
@@ -3,5 +3,5 @@ fun maybeFoo(): String? {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
maybeFoo()?.length() maybeFoo()?.length
} }
@@ -5,7 +5,7 @@ fun maybeFoo(): String? {
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo = maybeFoo() val foo = maybeFoo()
if (null != foo<caret>) if (null != foo<caret>)
foo.length() foo.length
else else
null null
} }
@@ -3,5 +3,5 @@ fun maybeFoo(): String? {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
maybeFoo()?.length() maybeFoo()?.length
} }
@@ -1,10 +1,11 @@
// IS_APPLICABLE: false // IS_APPLICABLE: false
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.String?
fun main(args: Array<String>) { fun main(args: Array<String>) {
val foo: String? = "foo" val foo: String? = "foo"
if (foo == null<caret>) { if (foo == null<caret>) {
foo.length() foo.length
} }
else { else {
foo.length() foo.length
} }
} }
@@ -1,9 +1,11 @@
class Klass<T>
fun test(obj: Any): String { fun test(obj: Any): String {
return <caret>if (obj is String) return <caret>if (obj is String)
"string" "string"
else if (obj is Int) else if (obj is Int)
"int" "int"
else if (obj is Class<*>) else if (obj is Klass<*>)
"class" "class"
else "unknown" else "unknown"
} }

Some files were not shown because too many files have changed in this diff Show More