FIR: Support FirComparisonOperator in body transformers and DFA

^KT-31163 In Progress
This commit is contained in:
Denis Zharkov
2020-02-26 16:45:57 +03:00
parent c3aed433ae
commit 434444cd69
31 changed files with 191 additions and 149 deletions
@@ -8,7 +8,7 @@ fun f(): Unit {
x = null
x <!INAPPLICABLE_CANDIDATE!>+<!> 1
x <!INAPPLICABLE_CANDIDATE!>plus<!> 1
x < 1
x <!INAPPLICABLE_CANDIDATE!><<!> 1
<!UNRESOLVED_REFERENCE!>x += 1<!>
x == 1
@@ -29,4 +29,4 @@ fun f(): Unit {
false || y
y && true
y && 1
}
}
@@ -1,6 +1,6 @@
// !WITH_NEW_INFERENCE
fun test() {
if (<!UNRESOLVED_REFERENCE!>x<!> > 0) {
if (<!UNRESOLVED_REFERENCE!>x<!> <!UNRESOLVED_REFERENCE!>><!> 0) {
}
}
}
@@ -13,5 +13,5 @@ public class B {
// FILE: main.kt
fun test() {
B.bar() { it.<!INAPPLICABLE_CANDIDATE!>hashCode<!>() > 0 }
B.bar() { it.<!INAPPLICABLE_CANDIDATE!>hashCode<!>() <!UNRESOLVED_REFERENCE!>><!> 0 }
}
@@ -1,2 +1,2 @@
// !WITH_NEW_INFERENCE
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!><<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>sdf<!>()()<!><out Any><!>::unwrap<!>
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!><!UNRESOLVED_REFERENCE!><<!><!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>sdf<!>()()<!><out Any><!>::unwrap<!>
@@ -8,9 +8,9 @@ fun composite() {
}
fun html() {
<!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>html<!>><!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>/<!><!UNRESOLVED_REFERENCE!>html<!>><!SYNTAX!><!>
<!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>html<!><!UNRESOLVED_REFERENCE!>><!><!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>/<!><!UNRESOLVED_REFERENCE!>html<!>><!SYNTAX!><!>
}
fun html1() {
<!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>html<!>><!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>/<!><!UNRESOLVED_REFERENCE!>html<!>><!UNRESOLVED_REFERENCE!>html<!>
}
<!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>html<!><!UNRESOLVED_REFERENCE!>><!><!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>/<!><!UNRESOLVED_REFERENCE!>html<!>><!UNRESOLVED_REFERENCE!>html<!>
}
@@ -11,7 +11,7 @@ fun takeFirst(expr: StringBuilder): Char {
fun evaluateArg(expr: CharSequence, numbers: ArrayList<Int>): Int {
if (expr.length == 0) throw Exception("Syntax error: Character expected");
val c = <!INAPPLICABLE_CANDIDATE!>takeFirst<!>(expr)
if (c >= '0' && c <= '9') {
if (c <!UNRESOLVED_REFERENCE!>>=<!> '0' && c <!UNRESOLVED_REFERENCE!><=<!> '9') {
val n = c <!UNRESOLVED_REFERENCE!>-<!> '0'
if (!numbers.contains(n)) throw Exception("You used incorrect number: " + n)
numbers.remove(n)
@@ -3,6 +3,6 @@
// See EA-76890 / KT-10843: NPE during analysis
fun lambda(x : Int?) = x?.<!UNRESOLVED_REFERENCE!>let<!> <!UNRESOLVED_REFERENCE!>l<!> {
y ->
if (y > 0) return@l x
if (y <!UNRESOLVED_REFERENCE!>><!> 0) return@l x
y
}!!
@@ -5,7 +5,7 @@ class A(val x: String?) {
fun foo(other: A) {
when {
x == null && other.x == null -> "1"
x.<!INAPPLICABLE_CANDIDATE!>length<!> > 0 -> "2"
x.<!INAPPLICABLE_CANDIDATE!>length<!> <!UNRESOLVED_REFERENCE!>><!> 0 -> "2"
}
}
}
}