[FIR] Handle fully qualified expressions separately in tower resolver

This commit is contained in:
Mikhail Glukhikh
2020-01-10 17:11:43 +03:00
parent 587430ff90
commit 5c6341b4e4
36 changed files with 204 additions and 47 deletions
@@ -12,6 +12,6 @@ inline fun myRun(block: () -> Unit): Unit {
}
fun test() {
myRun { throw java.lang.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>() }
myRun { throw java.lang.IllegalArgumentException() }
val x: Int = 42
}
@@ -22,7 +22,7 @@ fun throwIfNotCalled() {
return@outer
}
}
throw java.lang.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>()
throw java.lang.IllegalArgumentException()
}
// x *is* initialized here, because if myRun was never called -> exception
// were thrown and control flow wouldn't be here
@@ -39,7 +39,7 @@ fun catchThrowIfNotCalled() {
return@outer
}
}
throw java.lang.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>()
throw java.lang.IllegalArgumentException()
}
} catch (ignored: java.lang.IllegalArgumentException) { }
@@ -12,6 +12,6 @@ inline fun <T> myRun(block: () -> T): T {
}
fun throwInLambda(): Int {
val x = myRun { throw java.lang.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>(); 42 }
val x = myRun { throw java.lang.IllegalArgumentException(); 42 }
return x
}
@@ -18,6 +18,6 @@ fun bar(b: Boolean?): Boolean {
// not pointless, but not supported yet
returns(true) implies (b == true)
}
if (b == null) throw java.lang.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>("")
if (b == null) throw java.lang.IllegalArgumentException("")
return b
}
@@ -18,7 +18,7 @@ fun testCheckWithMessage(x: Any?) {
}
fun testCheckWithFailingMessage(x: Any?) {
check(x is String) { throw kotlin.<!UNRESOLVED_REFERENCE!>IllegalStateException<!>("What a strange idea") }
check(x is String) { throw kotlin.IllegalStateException("What a strange idea") }
x.length
}
@@ -17,7 +17,7 @@ fun testRequireWithMessage(x: Any?) {
}
fun testRequireWithFailingMessage(x: Any?) {
require(x is String) { throw kotlin.<!UNRESOLVED_REFERENCE!>IllegalStateException<!>("What a strange idea") }
require(x is String) { throw kotlin.IllegalStateException("What a strange idea") }
x.length
}
@@ -8,7 +8,7 @@ fun myAssert(condition: Boolean, message: String = "") {
contract {
returns() implies (condition)
}
if (!condition) throw kotlin.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>(message)
if (!condition) throw kotlin.IllegalArgumentException(message)
}
fun test(x: Any?) {
@@ -8,7 +8,7 @@ fun myAssert(condition: Boolean) {
contract {
returns() implies (condition)
}
if (!condition) throw kotlin.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>("Assertion failed")
if (!condition) throw kotlin.IllegalArgumentException("Assertion failed")
}
fun testWithCatch(x: Any?) {
@@ -9,7 +9,7 @@ fun myAssert(condition: Boolean) {
contract {
returns() implies (condition)
}
if (!condition) throw kotlin.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>("Assertion failed")
if (!condition) throw kotlin.IllegalArgumentException("Assertion failed")
}
fun isString(x: Any?): Boolean {
@@ -8,7 +8,7 @@ fun myAssert(condition: Boolean) {
contract {
returns() implies (condition)
}
if (!condition) throw kotlin.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>("Assertion failed")
if (!condition) throw kotlin.IllegalArgumentException("Assertion failed")
}
fun testAssertSmartcast(x: Any?) {
@@ -18,14 +18,14 @@ class C : java.util.concurrent.ConcurrentHashMap<String, Int>() {
}
fun main() {
val hm = java.util.concurrent.<!UNRESOLVED_REFERENCE!>ConcurrentHashMap<!><String, Int>()
val hm = java.util.concurrent.ConcurrentHashMap<String, Int>()
"" in hm
"" !in hm
1 <!AMBIGUITY, UNRESOLVED_REFERENCE!>!in<!> hm
2 <!AMBIGUITY!>in<!> hm
1 !in hm
2 in hm
hm.contains("")
hm.<!AMBIGUITY!>contains<!>(1)
hm.contains(1)
"" in (hm as Map<String, Int>)
"" !in (hm as Map<String, Int>)
@@ -18,14 +18,14 @@ class C : java.util.concurrent.ConcurrentHashMap<String, Int>() {
}
fun main() {
val hm = java.util.concurrent.<!UNRESOLVED_REFERENCE!>ConcurrentHashMap<!><String, Int>()
val hm = java.util.concurrent.ConcurrentHashMap<String, Int>()
"" in hm
"" !in hm
1 <!AMBIGUITY, UNRESOLVED_REFERENCE!>!in<!> hm
2 <!AMBIGUITY!>in<!> hm
1 !in hm
2 in hm
hm.contains("")
hm.<!AMBIGUITY!>contains<!>(1)
hm.contains(1)
"" in (hm as Map<String, Int>)
"" !in (hm as Map<String, Int>)
@@ -70,7 +70,7 @@ class My(val x: Int) {
when {
y > 0 -> MyBase.derivedWrapper()
x < 0 -> MyBase.exoticWrapper(x)
else -> throw java.lang.<!UNRESOLVED_REFERENCE!>NullPointerException<!>("")
else -> throw java.lang.NullPointerException("")
}
}
}
@@ -1,9 +1,9 @@
fun fn(): Nothing = throw java.lang.<!UNRESOLVED_REFERENCE!>RuntimeException<!>("oops")
fun fn(): Nothing = throw java.lang.RuntimeException("oops")
val x: Nothing = throw java.lang.<!UNRESOLVED_REFERENCE!>RuntimeException<!>("oops")
val x: Nothing = throw java.lang.RuntimeException("oops")
class SomeClass {
fun method() {
throw java.lang.<!UNRESOLVED_REFERENCE!>AssertionError<!>("!!!")
throw java.lang.AssertionError("!!!")
}
}
@@ -42,7 +42,7 @@ fun Throwable.fillInStackTrace() = 1
fun foo(x: List<String>, y: Throwable, z: A3) {
x.stream()
java.util.<!UNRESOLVED_REFERENCE!>ArrayList<!><String>().<!UNRESOLVED_REFERENCE!>stream<!>()
java.util.ArrayList<String>().stream()
y.fillInStackTrace() checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
@@ -1,3 +1,3 @@
// FILE: test.kt
val fooException = Exception("foo")
val barException = kotlin.<!UNRESOLVED_REFERENCE!>Exception<!>("bar")
val barException = kotlin.Exception("bar")
@@ -2,4 +2,4 @@
// !API_VERSION: 1.0
// FILE: test.kt
val fooException = Exception("foo")
val barException = kotlin.<!UNRESOLVED_REFERENCE!>Exception<!>("bar")
val barException = kotlin.Exception("bar")
@@ -1,4 +1,4 @@
// !LANGUAGE: -TypeAliases
// FILE: test.kt
val fooException = Exception("foo")
val barException = kotlin.<!UNRESOLVED_REFERENCE!>Exception<!>("bar")
val barException = kotlin.Exception("bar")