[FIR] Handle fully qualified expressions separately in tower resolver
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
fun box() : String {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNREACHABLE_CODE
|
||||
|
||||
fun TODO(): Nothing = throw java.lang.<!UNRESOLVED_REFERENCE!>IllegalStateException<!>()
|
||||
fun TODO(): Nothing = throw java.lang.IllegalStateException()
|
||||
|
||||
open class OpenClass
|
||||
class FinalClass : OpenClass()
|
||||
|
||||
Vendored
+1
-1
@@ -151,7 +151,7 @@ fun foo(a : Nothing) : Unit {
|
||||
}
|
||||
|
||||
fun fail() : Nothing {
|
||||
throw java.lang.<!UNRESOLVED_REFERENCE!>RuntimeException<!>()
|
||||
throw java.lang.RuntimeException()
|
||||
}
|
||||
|
||||
fun nullIsNotNothing() : Unit {
|
||||
|
||||
compiler/testData/diagnostics/tests/controlStructures/kt770.fir.kt351.fir.kt735_StatementType.fir.kt
Vendored
+1
-1
@@ -140,7 +140,7 @@ fun testCoercionToAny() {
|
||||
fun fooWithAnuNullableResult(s: String?, name: String, optional: Boolean): Any? {
|
||||
return if (s == null) {
|
||||
if (!optional) {
|
||||
throw java.lang.<!UNRESOLVED_REFERENCE!>IllegalArgumentException<!>("Parameter '$name' was not found in the request")
|
||||
throw java.lang.IllegalArgumentException("Parameter '$name' was not found in the request")
|
||||
}
|
||||
null
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ operator fun <T : Any> T?.iterator() = object : MyIterator<T> {
|
||||
hasNext = false
|
||||
return this@iterator!!
|
||||
}
|
||||
throw java.util.<!UNRESOLVED_REFERENCE!>NoSuchElementException<!>()
|
||||
throw java.util.NoSuchElementException()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -11,6 +11,6 @@ public class Clazz<Psi> {
|
||||
public fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo(destination: C, predicate: (T) -> Boolean) {}
|
||||
|
||||
fun test(clazz: Clazz<out Any>) {
|
||||
val result = java.util.<!UNRESOLVED_REFERENCE!>ArrayList<!><Any>()
|
||||
clazz.foo().<!INAPPLICABLE_CANDIDATE!>filterTo<!>(result) { x -> true }
|
||||
val result = java.util.ArrayList<Any>()
|
||||
clazz.foo().filterTo(result) { x -> true }
|
||||
}
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ fun test1() {
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val m0 = java.util.<!UNRESOLVED_REFERENCE!>HashMap<!>()
|
||||
val m1 = java.util.<!UNRESOLVED_REFERENCE!>HashMap<!><String, String, String>()
|
||||
val m2 = java.util.<!UNRESOLVED_REFERENCE!>HashMap<!><String>()
|
||||
val m0 = java.util.HashMap()
|
||||
val m1 = java.util.HashMap<String, String, String>()
|
||||
val m2 = java.util.HashMap<String>()
|
||||
}
|
||||
@@ -28,7 +28,7 @@ fun test() {
|
||||
fun <T> arrayList(vararg values: T) : ArrayList<T> = values.toCollection(ArrayList<T>(values.size))
|
||||
|
||||
fun <T, R> Collection<T>.map(transform : (T) -> R) : List<R> {
|
||||
return <!INAPPLICABLE_CANDIDATE!>mapTo<!>(java.util.<!UNRESOLVED_REFERENCE!>ArrayList<!><R>(this.size), transform)
|
||||
return mapTo(java.util.ArrayList<R>(this.size), transform)
|
||||
}
|
||||
|
||||
fun <T, R, C: MutableCollection<in R>> Collection<T>.mapTo(result: C, transform : (T) -> R) : C {
|
||||
|
||||
@@ -9,5 +9,5 @@ package a
|
||||
|
||||
fun foo() {
|
||||
// If this fails, it means that we have broken the rule that Java returns are always nullable
|
||||
a.<!UNRESOLVED_REFERENCE!>Test<!><Int>().<!UNRESOLVED_REFERENCE!>t<!>() + 1
|
||||
a.Test<Int>().t() + 1
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
package kt1270
|
||||
|
||||
fun foo() {
|
||||
val sc = <!UNRESOLVED_REFERENCE!>java.util.<!UNRESOLVED_REFERENCE!>HashMap<!><String, SomeClass>()[""]<!>
|
||||
val value = sc.<!UNRESOLVED_REFERENCE!>value<!>
|
||||
val sc = java.util.HashMap<String, SomeClass>()[""]
|
||||
val value = sc.<!INAPPLICABLE_CANDIDATE!>value<!>
|
||||
}
|
||||
|
||||
private class SomeClass() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// KT-459 Type argument inference fails when class names are fully qualified
|
||||
|
||||
fun test() {
|
||||
val attributes : java.util.HashMap<String, String> = java.util.<!UNRESOLVED_REFERENCE!>HashMap<!>() // failure!
|
||||
val attributes : java.util.HashMap<String, String> = java.util.HashMap() // failure!
|
||||
attributes["href"] = "1" // inference fails, but it shouldn't
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
package demo
|
||||
|
||||
fun <T> filter(list : Array<T>, filter : (T) -> Boolean) : List<T> {
|
||||
val answer = java.util.<!UNRESOLVED_REFERENCE!>ArrayList<!><T>();
|
||||
val answer = java.util.ArrayList<T>();
|
||||
for (l in list) {
|
||||
if (filter(l)) answer.<!UNRESOLVED_REFERENCE!>add<!>(l)
|
||||
if (filter(l)) answer.add(l)
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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
|
||||
}
|
||||
+2
-2
@@ -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) { }
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
}
|
||||
Vendored
+1
-1
@@ -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
|
||||
}
|
||||
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -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?) {
|
||||
|
||||
Vendored
+1
-1
@@ -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?) {
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
+1
-1
@@ -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?) {
|
||||
|
||||
+4
-4
@@ -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>)
|
||||
|
||||
+4
-4
@@ -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("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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("!!!")
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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
-1
@@ -1,3 +1,3 @@
|
||||
// FILE: test.kt
|
||||
val fooException = Exception("foo")
|
||||
val barException = kotlin.<!UNRESOLVED_REFERENCE!>Exception<!>("bar")
|
||||
val barException = kotlin.Exception("bar")
|
||||
|
||||
+1
-1
@@ -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
-1
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user