Skip to content

Commit

Permalink
[Kotlin] Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sschr15 committed Aug 25, 2024
1 parent 087e269 commit 36bf983
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion plugins/kotlin/testData/results/pkg/TestContracts.dec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class TestContracts {
returns() implies (x is Int)
}

if (x !is Integer) {// 31
if (x !is Int) {// 31
throw new IllegalStateException("x is not Int".toString());
} else {
return (x as java.lang.Number).intValue();// 32
Expand Down
4 changes: 2 additions & 2 deletions plugins/kotlin/testData/results/pkg/TestDestructors.dec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlin.jvm.internal.SourceDebugExtension
@SourceDebugExtension(["SMAP\nTestDestructors.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestDestructors.kt\npkg/TestDestructors\n*L\n1#1,71:1\n68#1,3:72\n68#1,3:75\n*S KotlinDebug\n*F\n+ 1 TestDestructors.kt\npkg/TestDestructors\n*L\n49#1:72,3\n54#1:75,3\n*E\n"])
public class TestDestructors {
public fun destructDataClasses(x: Pair<String, Int?>, y: Triple<Number, Boolean?, String>) {
System.out.println("${x.component1() as java.lang.String} ${x.component2() as Integer}");// 8 9
System.out.println("${x.component1() as java.lang.String} ${x.component2() as Int}");// 8 9
System.out.println("${y.component1() as java.lang.Number} ${y.component2() as java.lang.Boolean} ${y.component3() as java.lang.String}");// 11 12
}// 13

Expand All @@ -19,7 +19,7 @@ public class TestDestructors {
}// 24

public fun destructDataClassesSkip(x: Triple<String, Int?, String>, y: Triple<Number, Boolean?, String>) {
System.out.println(x.component2() as Integer);// 30 31
System.out.println(x.component2() as Int);// 30 31
System.out.println("${y.component1() as java.lang.Number} ${y.component3() as java.lang.String}");// 33 34
}// 35

Expand Down
2 changes: 1 addition & 1 deletion plugins/kotlin/testData/results/pkg/TestFunVarargs.dec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class TestFunVarargs {
}// 10

public fun log(vararg entries: String) {
this.printAll(Arrays.copyOf(entries, entries.length) as java.lang.String[]);// 13
this.printAll(Arrays.copyOf(entries, entries.length) as Array<java.lang.String>);// 13
this.printAllArray(entries);// 14
}// 15

Expand Down
32 changes: 16 additions & 16 deletions plugins/kotlin/testData/results/pkg/TestSafeCasts.dec
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package pkg

public class TestSafeCasts {
public fun test(obj: Any): Boolean {
val t: Int = obj as? Integer;// 5
if ((obj as? Integer) != null) {// 7
val t: Int = obj as? Int;// 5
if ((obj as? Int) != null) {// 7
if (t == 1) {
return true;
}
Expand All @@ -13,11 +13,11 @@ public class TestSafeCasts {
}

public fun testTestBefore(obj: Any): Boolean? {
if (obj !is Integer) {// 11
if (obj !is Int) {// 11
return null;// 12
} else {
val t: Int = obj as? Integer;// 15
if ((obj as? Integer) != null) {// 17
val t: Int = obj as? Int;// 15
if ((obj as? Int) != null) {// 17
if (t == 1) {
return true;
}
Expand All @@ -32,12 +32,12 @@ public class TestSafeCasts {
}

public fun testSmartCastIncompatible(obj: Any): Boolean {
return obj is Integer && (obj as? java.lang.String) == "1";// 27 31 33
return obj is Int && (obj as? java.lang.String) == "1";// 27 31 33
}

public fun testCastNonNullToNullable(obj: Any): Boolean {
val t: Int = obj as? Integer;// 37
if ((obj as? Integer) != null) {// 39
val t: Int = obj as? Int;// 37
if ((obj as? Int) != null) {// 39
if (t == 1) {
return true;
}
Expand All @@ -47,11 +47,11 @@ public class TestSafeCasts {
}

public fun testBeforeNonNullToNullable(obj: Any): Boolean? {
if (obj !is Integer) {// 43
if (obj !is Int) {// 43
return null;// 44
} else {
val t: Int = obj as? Integer;// 47
if ((obj as? Integer) != null) {// 49
val t: Int = obj as? Int;// 47
if ((obj as? Int) != null) {// 49
if (t == 1) {
return true;
}
Expand All @@ -62,8 +62,8 @@ public class TestSafeCasts {
}

public fun testCastNullableToNullable(obj: Any?): Boolean {
val t: Int = obj as? Integer;// 53
if ((obj as? Integer) != null) {// 55
val t: Int = obj as? Int;// 53
if ((obj as? Int) != null) {// 55
if (t == 1) {
return true;
}
Expand All @@ -73,11 +73,11 @@ public class TestSafeCasts {
}

public fun testBeforeNullableToNullable(obj: Any?): Boolean? {
if (obj != null && obj !is Integer) {// 59
if (obj != null && obj !is Int) {// 59
return null;// 60
} else {
val t: Int = obj as? Integer;// 63
if ((obj as? Integer) != null) {// 65
val t: Int = obj as? Int;// 63
if ((obj as? Int) != null) {// 65
if (t == 1) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/kotlin/testData/results/pkg/TestSmartCasts.dec
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class TestSmartCasts {
}

public fun testDoubleType(t: List<String>): String {
return if (t is TestSmartCasts.X) (t as TestSmartCasts.X).woo(t as java.lang.Iterable<?>) else t.get(0) as java.lang.String;// 83 84 87
return if (t is TestSmartCasts.X) (t as TestSmartCasts.X).woo(t as MutableIterable<*>) else t.get(0) as java.lang.String;// 83 84 87
}

public sealed class A protected constructor() {
Expand Down
2 changes: 1 addition & 1 deletion plugins/kotlin/testData/results/pkg/TestWhen.dec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class TestWhen {
System.out.println("a == 15");
} else if (a == "!!") {// 27
System.out.println("a == !!");
} else if (a is Integer) {// 28
} else if (a is Int) {// 28
System.out.println("a is Int");
} else if (a is java.lang.String) {// 29
System.out.println("a is String");
Expand Down

0 comments on commit 36bf983

Please sign in to comment.