[FIR-TEST] Update testdata of old FE contracts tests
This commit is contained in:
Vendored
+42
@@ -0,0 +1,42 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
package my
|
||||||
|
|
||||||
|
// Accepts block, can't be distinguished from kotlin.contract without resolve
|
||||||
|
fun contract(block: () -> Unit) {}
|
||||||
|
|
||||||
|
// Accepts int, potentially can be distinguished from kotlin.contract by PSI,
|
||||||
|
// but as of Kotlin 1.3.0, we don't do that
|
||||||
|
fun contract(i: Int) {}
|
||||||
|
|
||||||
|
fun doStuff() {}
|
||||||
|
|
||||||
|
class SomeClass {
|
||||||
|
|
||||||
|
fun contract() {}
|
||||||
|
|
||||||
|
fun callMemberContractWithThis() {
|
||||||
|
this.contract()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun callMemberContractWithoutThis() {
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>contract<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun callTopLevelSamePsiInMember() {
|
||||||
|
contract { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun callTopLevelSamePsi() {
|
||||||
|
contract { }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun callTopLevelDifferentPsi() {
|
||||||
|
contract(42)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun callTopLevelSamePsiNotFirstStatement() {
|
||||||
|
doStuff()
|
||||||
|
contract { }
|
||||||
|
}
|
||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// FIR_IDENTICAL
|
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
package my
|
package my
|
||||||
|
|||||||
Vendored
+2
-2
@@ -58,11 +58,11 @@ val topLevelAnonymousFunction = fun (x: Boolean) {
|
|||||||
|
|
||||||
var topLevelPropertyAccessors: Int? = 42
|
var topLevelPropertyAccessors: Int? = 42
|
||||||
get() {
|
get() {
|
||||||
contract { returns() implies (field != null) }
|
contract { returns() implies (<!UNRESOLVED_REFERENCE!>field<!> != null) }
|
||||||
return 42
|
return 42
|
||||||
}
|
}
|
||||||
set(value) {
|
set(value) {
|
||||||
contract { returns() implies (field != null) }
|
contract { returns() implies (<!UNRESOLVED_REFERENCE!>field<!> != null) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -73,11 +73,11 @@ val topLevelAnonymousFunction = fun (x: Boolean) {
|
|||||||
|
|
||||||
var topLevelPropertyAccessors: Int? = 42
|
var topLevelPropertyAccessors: Int? = 42
|
||||||
get() {
|
get() {
|
||||||
contract { returns() implies (field != null) }
|
contract { returns() implies (<!UNRESOLVED_REFERENCE!>field<!> != null) }
|
||||||
return 42
|
return 42
|
||||||
}
|
}
|
||||||
set(value) {
|
set(value) {
|
||||||
contract { returns() implies (field != null) }
|
contract { returns() implies (<!UNRESOLVED_REFERENCE!>field<!> != null) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -25,9 +25,9 @@ fun whenInContract(x: Any?, boolean: Boolean) {
|
|||||||
|
|
||||||
fun forInContract(x: Any?) {
|
fun forInContract(x: Any?) {
|
||||||
contract {
|
contract {
|
||||||
for (i in 0..1) {
|
<!UNRESOLVED_REFERENCE!>for (i in 0..1) {
|
||||||
returns() implies (x is String)
|
returns() implies (x is String)
|
||||||
}
|
}<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||||
|
// !LANGUAGE: +UseReturnsEffect
|
||||||
|
// Issue: KT-26386
|
||||||
|
|
||||||
|
fun myRun(block: () -> Unit) {
|
||||||
|
block()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun contract(block: () -> Unit) {
|
||||||
|
block()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun case_1(): Boolean? {
|
||||||
|
contract { case_1() }
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun case_2(): Boolean? {
|
||||||
|
contract { case_3() }
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun case_3(): Boolean? {
|
||||||
|
contract { case_2() }
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun case4() {
|
||||||
|
contract {
|
||||||
|
myRun {
|
||||||
|
val s: String
|
||||||
|
run {
|
||||||
|
<!UNRESOLVED_REFERENCE!>s<!> = "hello"
|
||||||
|
}
|
||||||
|
<!UNRESOLVED_REFERENCE!>s<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// FIR_IDENTICAL
|
|
||||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||||
// !LANGUAGE: +UseReturnsEffect
|
// !LANGUAGE: +UseReturnsEffect
|
||||||
// Issue: KT-26386
|
// Issue: KT-26386
|
||||||
|
|||||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ import kotlin.contracts.*
|
|||||||
class Foo(val x: Int?) {
|
class Foo(val x: Int?) {
|
||||||
fun isXNull(): Boolean {
|
fun isXNull(): Boolean {
|
||||||
contract {
|
contract {
|
||||||
returns(false) implies (x != null)
|
returns(false) implies (<!UNRESOLVED_REFERENCE!>x<!> != null)
|
||||||
}
|
}
|
||||||
return x != null
|
return x != null
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ import kotlin.contracts.*
|
|||||||
class Foo(val x: Int?) {
|
class Foo(val x: Int?) {
|
||||||
fun isXNull(): Boolean {
|
fun isXNull(): Boolean {
|
||||||
contract {
|
contract {
|
||||||
returns(false) implies (x != null)
|
returns(false) implies (<!UNRESOLVED_REFERENCE!>x<!> != null)
|
||||||
}
|
}
|
||||||
return x != null
|
return x != null
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ import kotlin.contracts.*
|
|||||||
|
|
||||||
fun test(x: Any?) {
|
fun test(x: Any?) {
|
||||||
if (isString(x)) {
|
if (isString(x)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -13,5 +13,5 @@ fun myAssert(condition: Boolean, message: String = "") {
|
|||||||
|
|
||||||
fun test(x: Any?) {
|
fun test(x: Any?) {
|
||||||
myAssert(x is String)
|
myAssert(x is String)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
Vendored
+2
-2
@@ -14,8 +14,8 @@ fun myAssert(condition: Boolean) {
|
|||||||
fun testWithCatch(x: Any?) {
|
fun testWithCatch(x: Any?) {
|
||||||
try {
|
try {
|
||||||
myAssert(x is String)
|
myAssert(x is String)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
} catch (e: java.lang.IllegalArgumentException) { }
|
} catch (e: java.lang.IllegalArgumentException) { }
|
||||||
|
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
+2
-2
@@ -13,7 +13,7 @@ fun isString(x: Any?): Boolean {
|
|||||||
|
|
||||||
fun testEqualsWithConstant(x: Any?) {
|
fun testEqualsWithConstant(x: Any?) {
|
||||||
if (isString(x) == true) {
|
if (isString(x) == true) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -25,7 +25,7 @@ fun testNotEqualsWithConstant(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -19,7 +19,7 @@ class Foo {
|
|||||||
|
|
||||||
fun test_1(foo: Foo, x: Any) {
|
fun test_1(foo: Foo, x: Any) {
|
||||||
foo.require(x is String)
|
foo.require(x is String)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test_2(foo: Foo): Int {
|
fun test_2(foo: Foo): Int {
|
||||||
|
|||||||
+7
-7
@@ -54,7 +54,7 @@ fun nullWhenNotString(x: Any?): String? {
|
|||||||
|
|
||||||
fun nested1(x: Any?) {
|
fun nested1(x: Any?) {
|
||||||
if (equalsTrue(isString(x))) {
|
if (equalsTrue(isString(x))) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -63,7 +63,7 @@ fun nested1(x: Any?) {
|
|||||||
|
|
||||||
fun nested2(x: Any?) {
|
fun nested2(x: Any?) {
|
||||||
myAssert(equalsTrue(isString(x)))
|
myAssert(equalsTrue(isString(x)))
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
|
|
||||||
fun nested3(x: Any?) {
|
fun nested3(x: Any?) {
|
||||||
@@ -74,14 +74,14 @@ fun nested3(x: Any?) {
|
|||||||
fun branchedAndNested(x: Any?, y: Any?) {
|
fun branchedAndNested(x: Any?, y: Any?) {
|
||||||
myAssert(equalsTrue(notEqualsNull(nullWhenNotString(x))) && equalsTrue(isString(y)))
|
myAssert(equalsTrue(notEqualsNull(nullWhenNotString(x))) && equalsTrue(isString(y)))
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
y.<!UNRESOLVED_REFERENCE!>length<!>
|
y.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun br(y: Any?) {
|
fun br(y: Any?) {
|
||||||
if (myAssert(y is Int) == Unit && myAssert(y is String) == Unit) {
|
if (myAssert(y is Int) == Unit && myAssert(y is String) == Unit) {
|
||||||
y.<!UNRESOLVED_REFERENCE!>length<!>
|
y.length
|
||||||
y.<!AMBIGUITY!>inc<!>()
|
y.inc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ fun branchedAndNestedWithNativeOperators(x: Any?, y: Any?) {
|
|||||||
(1 == 2 || y is Int || isString(y))
|
(1 == 2 || y is Int || isString(y))
|
||||||
)
|
)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
y.<!UNRESOLVED_REFERENCE!>length<!>
|
y.length
|
||||||
y.<!AMBIGUITY!>inc<!>()
|
y.inc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@ fun notIsInt(x: Any?): Boolean {
|
|||||||
|
|
||||||
fun intersectingInfo(x: Any?, y: Any?) {
|
fun intersectingInfo(x: Any?, y: Any?) {
|
||||||
if ((isString(x) && y is String) || (!notIsString(x) && !notIsInt(y))) {
|
if ((isString(x) && y is String) || (!notIsString(x) && !notIsInt(y))) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
y.<!UNRESOLVED_REFERENCE!>length<!>
|
y.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
y.<!AMBIGUITY!>inc<!>()
|
y.<!AMBIGUITY!>inc<!>()
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ fun intersectingInfo2(x: Any?, y: Any?) {
|
|||||||
if ((isString(x) && !notIsInt(x) && y is String) ||
|
if ((isString(x) && !notIsInt(x) && y is String) ||
|
||||||
(!notIsString(x) && isString(y) && y is Int) ||
|
(!notIsString(x) && isString(y) && y is Int) ||
|
||||||
(x is String && !notIsInt(y) && x is Int)) {
|
(x is String && !notIsInt(y) && x is Int)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
y.<!UNRESOLVED_REFERENCE!>length<!>
|
y.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
y.<!AMBIGUITY!>inc<!>()
|
y.<!AMBIGUITY!>inc<!>()
|
||||||
|
|||||||
Vendored
+4
-4
@@ -23,8 +23,8 @@ fun testDeMorgan(x: Any?) {
|
|||||||
// !(x !is String || x !is Int)
|
// !(x !is String || x !is Int)
|
||||||
// x is String && x is Int
|
// x is String && x is Int
|
||||||
if (!(notIsString(x) || notIsInt(x))) {
|
if (!(notIsString(x) || notIsInt(x))) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.inc()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -39,7 +39,7 @@ fun testDeMorgan2(x: Any?) {
|
|||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.inc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
+4
-4
@@ -32,7 +32,7 @@ fun trueAndFalse(b: Boolean): Boolean {
|
|||||||
|
|
||||||
fun useOnlyTrueInTrueBranch(x: Any?) {
|
fun useOnlyTrueInTrueBranch(x: Any?) {
|
||||||
if (onlyTrue(x is String)) {
|
if (onlyTrue(x is String)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -64,13 +64,13 @@ fun useOnlyFalseInFalseBranch(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun useTrueAndFalseInTrueBranch(x: Any?) {
|
fun useTrueAndFalseInTrueBranch(x: Any?) {
|
||||||
if (trueAndFalse(x is String)) {
|
if (trueAndFalse(x is String)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -82,6 +82,6 @@ fun useTrueAndFalseInFalseBranch(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -22,7 +22,7 @@ fun smartcastAndInitialization(x: Any?) {
|
|||||||
|
|
||||||
if (callsAndInverts(x !is String) { y = 42 }) {
|
if (callsAndInverts(x !is String) { y = 42 }) {
|
||||||
println(y)
|
println(y)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
} else {
|
} else {
|
||||||
println(y)
|
println(y)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -35,7 +35,7 @@ fun inPresenceOfLazy(x: Any?, unknownBoolean: Boolean) {
|
|||||||
|
|
||||||
if (unknownBoolean && callsAndInverts(x !is String) { y = 42 }) {
|
if (unknownBoolean && callsAndInverts(x !is String) { y = 42 }) {
|
||||||
println(y)
|
println(y)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println(y)
|
println(y)
|
||||||
@@ -47,7 +47,7 @@ fun inPresenceOfLazy(x: Any?, unknownBoolean: Boolean) {
|
|||||||
fun isPresenceOfLazy2(x: Any?, unknownBoolean: Boolean) {
|
fun isPresenceOfLazy2(x: Any?, unknownBoolean: Boolean) {
|
||||||
val y: Int
|
val y: Int
|
||||||
if (unknownBoolean && callsAndInverts(x !is String) { y = 42 }) {
|
if (unknownBoolean && callsAndInverts(x !is String) { y = 42 }) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println(y)
|
println(y)
|
||||||
@@ -59,7 +59,7 @@ fun isPresenceOfLazy2(x: Any?, unknownBoolean: Boolean) {
|
|||||||
fun isPresenceOfLazy3(x: Any?, unknownBoolean: Boolean) {
|
fun isPresenceOfLazy3(x: Any?, unknownBoolean: Boolean) {
|
||||||
val y: Int
|
val y: Int
|
||||||
if (unknownBoolean && callsAndInverts(x !is String) { y = 42 }) {
|
if (unknownBoolean && callsAndInverts(x !is String) { y = 42 }) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ fun nullWhenNull(x: Int?): Int? {
|
|||||||
|
|
||||||
fun testNullWhenNull(x: Int?) {
|
fun testNullWhenNull(x: Int?) {
|
||||||
if (nullWhenNull(x) == null) {
|
if (nullWhenNull(x) == null) {
|
||||||
x.<!AMBIGUITY!>dec<!>()
|
x.dec()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!AMBIGUITY!>dec<!>()
|
x.<!AMBIGUITY!>dec<!>()
|
||||||
@@ -24,7 +24,7 @@ fun testNullWhenNull(x: Int?) {
|
|||||||
x.<!AMBIGUITY!>dec<!>()
|
x.<!AMBIGUITY!>dec<!>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!AMBIGUITY!>dec<!>()
|
x.dec()
|
||||||
}
|
}
|
||||||
|
|
||||||
x.<!AMBIGUITY!>dec<!>()
|
x.<!AMBIGUITY!>dec<!>()
|
||||||
|
|||||||
compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperator.fir.kt
Vendored
+4
-4
@@ -38,8 +38,8 @@ fun falseWhenInt(x: Any?): Boolean {
|
|||||||
|
|
||||||
fun truetrue(x: Any?) {
|
fun truetrue(x: Any?) {
|
||||||
if (trueWhenString(x) && trueWhenInt(x)) {
|
if (trueWhenString(x) && trueWhenInt(x)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.inc()
|
||||||
}
|
}
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
@@ -47,7 +47,7 @@ fun truetrue(x: Any?) {
|
|||||||
|
|
||||||
fun truefalse(x: Any?) {
|
fun truefalse(x: Any?) {
|
||||||
if (trueWhenString(x) && falseWhenInt(x)) {
|
if (trueWhenString(x) && falseWhenInt(x)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -59,7 +59,7 @@ fun truefalse(x: Any?) {
|
|||||||
fun falsetrue(x: Any?) {
|
fun falsetrue(x: Any?) {
|
||||||
if (falseWhenString(x) && trueWhenInt(x)) {
|
if (falseWhenString(x) && trueWhenInt(x)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.inc()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|||||||
+2
-2
@@ -23,7 +23,7 @@ fun falseWhenString(x: Any?): Boolean {
|
|||||||
|
|
||||||
fun annotatedTrueAndTrue(x: Any?) {
|
fun annotatedTrueAndTrue(x: Any?) {
|
||||||
if (trueWhenString(x) && true) {
|
if (trueWhenString(x) && true) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -33,7 +33,7 @@ fun annotatedTrueAndTrue(x: Any?) {
|
|||||||
fun annotatedTrueAndFalse(x: Any?) {
|
fun annotatedTrueAndFalse(x: Any?) {
|
||||||
if (trueWhenString(x) && false) {
|
if (trueWhenString(x) && false) {
|
||||||
// Unreachable
|
// Unreachable
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@ fun unknownFunction(x: Any?) = x == 42
|
|||||||
|
|
||||||
fun annotatedTrue(x: Any?) {
|
fun annotatedTrue(x: Any?) {
|
||||||
if (trueWhenString(x) && unknownFunction(x)) {
|
if (trueWhenString(x) && unknownFunction(x)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -43,7 +43,7 @@ fun annotatedFalse(x: Any?) {
|
|||||||
|
|
||||||
fun annotatedTrueWithVariable(x: Any?, b: Boolean) {
|
fun annotatedTrueWithVariable(x: Any?, b: Boolean) {
|
||||||
if (trueWhenString(x) && b) {
|
if (trueWhenString(x) && b) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|||||||
+2
-2
@@ -26,7 +26,7 @@ fun testBasicEquals(x: Int?) {
|
|||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.inc()
|
||||||
}
|
}
|
||||||
|
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
@@ -36,7 +36,7 @@ fun testBasicNotEquals(x: Int?) {
|
|||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
|
|
||||||
if (myEqualsNotNull(x)) {
|
if (myEqualsNotNull(x)) {
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.inc()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
|
|||||||
+4
-4
@@ -16,7 +16,7 @@ fun safeIsString(x: Any?): Boolean? {
|
|||||||
|
|
||||||
fun equalsTrue(x: Any?) {
|
fun equalsTrue(x: Any?) {
|
||||||
if (safeIsString(x) == true) {
|
if (safeIsString(x) == true) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -28,7 +28,7 @@ fun equalsFalse(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,13 +46,13 @@ fun notEqualsTrue(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun notEqualsFalse(x: Any?) {
|
fun notEqualsFalse(x: Any?) {
|
||||||
if (safeIsString(x) != false) {
|
if (safeIsString(x) != false) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|||||||
+4
-4
@@ -26,7 +26,7 @@ fun testSimple(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|
||||||
if (isString(x)) {
|
if (isString(x)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -36,7 +36,7 @@ fun testSimple(x: Any?) {
|
|||||||
fun testSpilling(x: Any?) {
|
fun testSpilling(x: Any?) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|
||||||
if (isString(x)) x.<!UNRESOLVED_REFERENCE!>length<!>
|
if (isString(x)) x.length
|
||||||
|
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
@@ -46,14 +46,14 @@ fun testInversion(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testInversionSpilling(x: Any?) {
|
fun testInversionSpilling(x: Any?) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|
||||||
if (notIsString(x)) else x.<!UNRESOLVED_REFERENCE!>length<!>
|
if (notIsString(x)) else x.length
|
||||||
|
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+4
-4
@@ -51,7 +51,7 @@ fun truefalse(x: Any?) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.inc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ fun falsetrue(x: Any?) {
|
|||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ fun falsefalse(x: Any?) {
|
|||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
x.<!AMBIGUITY!>inc<!>()
|
x.inc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -43,7 +43,7 @@ fun annotatedFalseOrTrue(x: Any?) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Unreachable
|
// Unreachable
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +52,6 @@ fun annotatedFalseOrFalse(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -37,7 +37,7 @@ fun annotatedFalse(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +55,6 @@ fun annotatedFalseWithVariable(x: Any?, b: Boolean) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ fun isString(x: Any?): Boolean {
|
|||||||
|
|
||||||
fun incorrectPartDoesntMatter(x: Any?) {
|
fun incorrectPartDoesntMatter(x: Any?) {
|
||||||
if (isString(x) && 1) {
|
if (isString(x) && 1) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ fun smartcastOnReceiver(x: Int?) {
|
|||||||
x.<!AMBIGUITY!>inc<!>()
|
x.<!AMBIGUITY!>inc<!>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!AMBIGUITY!>dec<!>()
|
x.dec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -13,7 +13,7 @@ fun myAssert(condition: Boolean) {
|
|||||||
|
|
||||||
fun testAssertSmartcast(x: Any?) {
|
fun testAssertSmartcast(x: Any?) {
|
||||||
myAssert(x is String)
|
myAssert(x is String)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testInvertedAssert(x: Any?) {
|
fun testInvertedAssert(x: Any?) {
|
||||||
@@ -24,34 +24,34 @@ fun testInvertedAssert(x: Any?) {
|
|||||||
fun testSpilling(x: Any?) {
|
fun testSpilling(x: Any?) {
|
||||||
if (x != null) {
|
if (x != null) {
|
||||||
myAssert(x is String)
|
myAssert(x is String)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testAssertInIf(x: Any?) {
|
fun testAssertInIf(x: Any?) {
|
||||||
if (myAssert(x is String) == Unit) {
|
if (myAssert(x is String) == Unit) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testTryCatch(x: Any?) {
|
fun testTryCatch(x: Any?) {
|
||||||
try {
|
try {
|
||||||
myAssert(x is String)
|
myAssert(x is String)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
} catch (e: kotlin.IllegalArgumentException) {
|
} catch (e: kotlin.IllegalArgumentException) {
|
||||||
|
|
||||||
}
|
}
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testUncertainFlow(x: Any?) {
|
fun testUncertainFlow(x: Any?) {
|
||||||
repeat(x.toString().length) {
|
repeat(x.toString().length) {
|
||||||
myAssert(x is String)
|
myAssert(x is String)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
@@ -59,8 +59,8 @@ fun testUncertainFlow(x: Any?) {
|
|||||||
fun testAtLeastOnceFlow(x: Any?) {
|
fun testAtLeastOnceFlow(x: Any?) {
|
||||||
do {
|
do {
|
||||||
myAssert(x is String)
|
myAssert(x is String)
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
} while (x != null)
|
} while (x != null)
|
||||||
|
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@ fun nullWhenNotString(x: Any?): Int? {
|
|||||||
fun test1(x: Any?) {
|
fun test1(x: Any?) {
|
||||||
// condition == true <=> function returned null <=> 'x' is String
|
// condition == true <=> function returned null <=> 'x' is String
|
||||||
if (nullWhenString(x) == null) {
|
if (nullWhenString(x) == null) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -43,7 +43,7 @@ fun test2(x: Any?) {
|
|||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -17,7 +17,7 @@ fun isString(x: Any?): Boolean {
|
|||||||
|
|
||||||
fun implicitAlwaysFalse(x: Any?) {
|
fun implicitAlwaysFalse(x: Any?) {
|
||||||
if (isString(x) && !isString(x)) {
|
if (isString(x) && !isString(x)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
@@ -26,7 +26,7 @@ fun implicitAlwaysFalse(x: Any?) {
|
|||||||
|
|
||||||
fun implicitAlwaysFalseSpilling(x: Any?) {
|
fun implicitAlwaysFalseSpilling(x: Any?) {
|
||||||
if (isString(x) && !isString(x)) {
|
if (isString(x) && !isString(x)) {
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.length
|
||||||
}
|
}
|
||||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
+4
-4
@@ -13,24 +13,24 @@ fun isString(x: Any?): Boolean {
|
|||||||
|
|
||||||
fun exhaustive(x: Any?) {
|
fun exhaustive(x: Any?) {
|
||||||
when (isString(x)) {
|
when (isString(x)) {
|
||||||
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
true -> x.length
|
||||||
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
when(!isString(x)) {
|
when(!isString(x)) {
|
||||||
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
false -> x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun smartcastInElse(x: Any?) {
|
fun smartcastInElse(x: Any?) {
|
||||||
when (isString(x)) {
|
when (isString(x)) {
|
||||||
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
else -> x.length
|
||||||
}
|
}
|
||||||
|
|
||||||
when (!isString(x)) {
|
when (!isString(x)) {
|
||||||
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
else -> x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-12
@@ -14,22 +14,22 @@ fun safeIsString(x: Any?): Boolean? {
|
|||||||
fun elseWithNullableResult(x: Any?) {
|
fun elseWithNullableResult(x: Any?) {
|
||||||
when (safeIsString(x)) {
|
when (safeIsString(x)) {
|
||||||
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
else -> x.length
|
||||||
|
}
|
||||||
|
|
||||||
|
when (safeIsString(x)) {
|
||||||
|
true -> x.length
|
||||||
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
when (safeIsString(x)) {
|
when (safeIsString(x)) {
|
||||||
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
true -> x.length
|
||||||
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
|
||||||
}
|
|
||||||
|
|
||||||
when (safeIsString(x)) {
|
|
||||||
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
|
||||||
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
when (safeIsString(x)) {
|
when (safeIsString(x)) {
|
||||||
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
true -> x.length
|
||||||
null -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
null -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
@@ -37,20 +37,20 @@ fun elseWithNullableResult(x: Any?) {
|
|||||||
|
|
||||||
fun exhaustiveWithNullableResult(x: Any?) {
|
fun exhaustiveWithNullableResult(x: Any?) {
|
||||||
when (safeIsString(x)) {
|
when (safeIsString(x)) {
|
||||||
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
true -> x.length
|
||||||
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
null -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
null -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
when (safeIsString(x)) {
|
when (safeIsString(x)) {
|
||||||
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
true -> x.length
|
||||||
null -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
null -> x.length
|
||||||
}
|
}
|
||||||
|
|
||||||
when (safeIsString(x)) {
|
when (safeIsString(x)) {
|
||||||
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
false -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
null -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
null -> x.length
|
||||||
true -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
true -> x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
+3
-3
@@ -13,19 +13,19 @@ fun isString(x: Any?): Boolean {
|
|||||||
|
|
||||||
fun exhaustive(x: Any?) {
|
fun exhaustive(x: Any?) {
|
||||||
when {
|
when {
|
||||||
isString(x) -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
isString(x) -> x.length
|
||||||
!isString(x) -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
!isString(x) -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
when {
|
when {
|
||||||
!isString(x) -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
!isString(x) -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
isString(x) -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
isString(x) -> x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun smartcastInElse(x: Any?) {
|
fun smartcastInElse(x: Any?) {
|
||||||
when {
|
when {
|
||||||
!isString(x) -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
!isString(x) -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
else -> x.<!UNRESOLVED_REFERENCE!>length<!>
|
else -> x.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user