[FIR] Add PLATFORM_CLASS_MAPPED_TO_KOTLIN
This commit is contained in:
committed by
TeamCityServer
parent
51b73bb6ae
commit
f046f2964b
@@ -1,10 +1,11 @@
|
||||
// FILE: a.kt
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
// FILE: a.kt
|
||||
|
||||
package foobar.a
|
||||
import java.*
|
||||
|
||||
val a : java.util.List<Int>? = null
|
||||
val a : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>? = null
|
||||
val a2 : <!UNRESOLVED_REFERENCE!>util.List<Int><!>? = null
|
||||
val a3 : <!UNRESOLVED_REFERENCE!>LinkedList<Int><!>? = null
|
||||
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
// FILE: a.kt
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
// FILE: a.kt
|
||||
|
||||
package foobar.a
|
||||
import java.*
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
interface A<T> {}
|
||||
interface B<T> {}
|
||||
interface C<T> {}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// Fixpoint generic in Java: Enum<T extends Enum<T>>
|
||||
fun test(a : java.lang.annotation.RetentionPolicy) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
java.util.Collections.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyList<!>()
|
||||
val a : Collection<String>? = java.util.Collections.emptyList()
|
||||
}
|
||||
|
||||
fun test(a : java.lang.Comparable<Int>) {
|
||||
|
||||
}
|
||||
|
||||
fun test(a : java.util.ArrayList<Int>) {
|
||||
|
||||
}
|
||||
|
||||
fun test(a : java.lang.Class<Int>) {
|
||||
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
// Fixpoint generic in Java: Enum<T extends Enum<T>>
|
||||
fun test(a : java.lang.annotation.RetentionPolicy) {
|
||||
|
||||
|
||||
+11
-10
@@ -1,6 +1,7 @@
|
||||
// !CHECK_TYPE
|
||||
// SKIP_JAVAC
|
||||
// FULL_JDK
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
// FILE: a.kt
|
||||
|
||||
@@ -9,17 +10,17 @@ import java.util.*
|
||||
import utils.*
|
||||
|
||||
import java.io.PrintStream
|
||||
import java.lang.Comparable as Com
|
||||
import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<!> as Com
|
||||
|
||||
val l : MutableList<in Int> = ArrayList<Int>()
|
||||
|
||||
fun test(l : java.util.List<Int>) {
|
||||
val x : <!UNRESOLVED_REFERENCE!>java.List<!>
|
||||
val y : java.util.List<Int>
|
||||
val b : java.lang.Object
|
||||
val z : <!UNRESOLVED_REFERENCE!>java.utils.List<Int><!>
|
||||
fun test(l : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>) {
|
||||
val <!UNUSED_VARIABLE!>x<!> : <!UNRESOLVED_REFERENCE!>java.List<!>
|
||||
val <!UNUSED_VARIABLE!>y<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>
|
||||
val <!UNUSED_VARIABLE!>b<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Object<!>
|
||||
val <!UNUSED_VARIABLE!>z<!> : <!UNRESOLVED_REFERENCE!>java.utils.List<Int><!>
|
||||
|
||||
val f : java.io.File? = null
|
||||
val <!UNUSED_VARIABLE!>f<!> : java.io.File? = null
|
||||
|
||||
Collections.<!FUNCTION_CALL_EXPECTED!>emptyList<!>
|
||||
Collections.<!FUNCTION_CALL_EXPECTED!>emptyList<!><<!CANNOT_INFER_PARAMETER_TYPE!>Int<!>>
|
||||
@@ -32,7 +33,7 @@ fun test(l : java.util.List<Int>) {
|
||||
<!NO_COMPANION_OBJECT!>List<Int><!>
|
||||
|
||||
|
||||
val o = "sdf" as Object
|
||||
val <!UNUSED_VARIABLE!>o<!> = "sdf" as <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!>
|
||||
|
||||
try {
|
||||
// ...
|
||||
@@ -43,9 +44,9 @@ fun test(l : java.util.List<Int>) {
|
||||
|
||||
PrintStream("sdf")
|
||||
|
||||
val c : Com<Int>? = null
|
||||
val c : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Com<Int><!>? = null
|
||||
|
||||
checkSubtype<java.lang.Comparable<Int>?>(c)
|
||||
checkSubtype<<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<Int><!>?>(c)
|
||||
|
||||
// Collections.sort<Integer>(ArrayList<Integer>())
|
||||
xxx.<!UNRESOLVED_REFERENCE!>Class<!>()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// !CHECK_TYPE
|
||||
// SKIP_JAVAC
|
||||
// FULL_JDK
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
// FILE: a.kt
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// JAVAC_EXPECTED_FILE
|
||||
interface MyTrait: <!INTERFACE_WITH_SUPERCLASS!>Object<!> {
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
interface MyTrait: <!INTERFACE_WITH_SUPERCLASS, PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!> {
|
||||
override fun toString(): String
|
||||
public override fun finalize()
|
||||
public <!OVERRIDING_FINAL_MEMBER!>override<!> fun wait()
|
||||
<!REDUNDANT_VISIBILITY_MODIFIER!>public<!> <!OVERRIDING_FINAL_MEMBER!>override<!> fun wait()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// JAVAC_EXPECTED_FILE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
interface MyTrait: <!INTERFACE_WITH_SUPERCLASS, PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!> {
|
||||
override fun toString(): String
|
||||
public override fun finalize()
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
// JAVAC_EXPECTED_FILE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
class TestIface(r : Runnable) : Runnable by r {}
|
||||
|
||||
class TestObject(o : Object) : <!DELEGATION_NOT_TO_INTERFACE, SUPERTYPE_NOT_INITIALIZED!>Object<!> by o {}
|
||||
class TestObject(o : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!>) : <!DELEGATION_NOT_TO_INTERFACE, PLATFORM_CLASS_MAPPED_TO_KOTLIN, PLATFORM_CLASS_MAPPED_TO_KOTLIN, PLATFORM_CLASS_MAPPED_TO_KOTLIN, SUPERTYPE_NOT_INITIALIZED!>Object<!> by o {}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// JAVAC_EXPECTED_FILE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
class TestIface(r : Runnable) : Runnable by r {}
|
||||
|
||||
class TestObject(o : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!>) : <!DELEGATION_NOT_TO_INTERFACE, PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!> by o {}
|
||||
@@ -1,6 +0,0 @@
|
||||
import java.lang.reflect.*
|
||||
import java.util.List
|
||||
|
||||
fun foo(
|
||||
p1: Array<String> /* should be resolved to kotlin.Array */,
|
||||
p2: List<String> /* should be resolved to java.util.List */) { }
|
||||
@@ -1,3 +1,6 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
import java.lang.reflect.*
|
||||
import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<!>
|
||||
|
||||
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
// !CHECK_TYPE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
package i
|
||||
|
||||
@@ -7,7 +8,7 @@ import java.util.*
|
||||
import checkSubtype
|
||||
|
||||
fun <T, R> Collection<T>.map1(f : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T, R> java.lang.Iterable<T>.map1(f : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T, R> <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Iterable<T><!>.map1(f : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
val res = list.map1 { it }
|
||||
@@ -16,7 +17,7 @@ fun test(list: List<Int>) {
|
||||
}
|
||||
|
||||
fun <T> Collection<T>.foo() {}
|
||||
fun <T> java.lang.Iterable<T>.foo() {}
|
||||
fun <T> <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Iterable<T><!>.foo() {}
|
||||
|
||||
fun test1(list: List<Int>) {
|
||||
val res = list.foo()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !CHECK_TYPE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
package i
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
//KT-2606 Filter java.util.* import
|
||||
package n
|
||||
|
||||
import java.util.*
|
||||
import java.lang.annotation.*
|
||||
|
||||
fun bar() : Iterator<Int>? {
|
||||
val i : Iterable<Integer>
|
||||
val a : Annotation
|
||||
return null
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
//KT-2606 Filter java.util.* import
|
||||
package n
|
||||
|
||||
|
||||
+10
-9
@@ -1,20 +1,21 @@
|
||||
// !CHECK_TYPE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
package a
|
||||
|
||||
import java.util.Iterator
|
||||
import java.lang.Comparable as Comp
|
||||
import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.Iterator<!>
|
||||
import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<!> as Comp
|
||||
|
||||
import checkSubtype
|
||||
|
||||
fun bar(any: Any): java.lang.Iterable<Int>? {
|
||||
val a: java.lang.Comparable<String>? = null
|
||||
val b: Iterable<Integer>
|
||||
val c : Iterator<String>? = null
|
||||
fun bar(any: Any): <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Iterable<Int><!>? {
|
||||
val <!UNUSED_VARIABLE!>a<!>: <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<String><!>? = null
|
||||
val <!UNUSED_VARIABLE!>b<!>: Iterable<<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Integer<!>>
|
||||
val <!UNUSED_VARIABLE!>c<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<String><!>? = null
|
||||
|
||||
if (any is Iterator<*>) {
|
||||
checkSubtype<Iterator<*>>(any)
|
||||
if (any is <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>) {
|
||||
checkSubtype<<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>>(any)
|
||||
}
|
||||
any as Iterator<*>
|
||||
any as <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !CHECK_TYPE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
package a
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !CHECK_TYPE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
//KT-1778 Automatically cast error
|
||||
package kt1778
|
||||
|
||||
@@ -6,7 +7,7 @@ import checkSubtype
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val x = checkSubtype<Any>(args[0])
|
||||
if(x is java.lang.CharSequence) {
|
||||
if(x is <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.CharSequence<!>) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>"a" == x<!>) x.<!FUNCTION_CALL_EXPECTED!>length<!> else x.length() // OK
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>"a" == x<!> || <!EQUALITY_NOT_APPLICABLE!>"b" == x<!>) x.<!FUNCTION_CALL_EXPECTED!>length<!> else x.length() // <– THEN ERROR
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>"a" == x<!> && <!EQUALITY_NOT_APPLICABLE!>"a" == x<!>) x.<!FUNCTION_CALL_EXPECTED!>length<!> else x.length() // <– ELSE ERROR
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !CHECK_TYPE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
//KT-1778 Automatically cast error
|
||||
package kt1778
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
class Generic<T>
|
||||
|
||||
fun redundantNullable(
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
interface A
|
||||
interface X: A<!NULLABLE_SUPERTYPE!>?<!><!REDUNDANT_NULLABLE!>?<!> {
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
// JET-72 Type inference doesn't work when iterating over ArrayList
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
abstract class Item(val room: Object) {
|
||||
abstract val name : String
|
||||
}
|
||||
|
||||
val items: ArrayList<Item> = ArrayList<Item>()
|
||||
|
||||
fun test(room : Object) {
|
||||
for(item: Item? in items) {
|
||||
if (item?.room === room) {
|
||||
// item?.room is not null
|
||||
System.out.println("You see " + <!SAFE_CALL_WILL_CHANGE_NULLABILITY!>item<!UNNECESSARY_SAFE_CALL!>?.<!>name<!>)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
// JET-72 Type inference doesn't work when iterating over ArrayList
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// !CHECK_TYPE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
import java.lang.Comparable as Comparable
|
||||
import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<!> as Comparable
|
||||
|
||||
fun f(c: Comparable<*>) {
|
||||
fun f(c: <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Comparable<*><!>) {
|
||||
checkSubtype<kotlin.Comparable<*>>(<!ARGUMENT_TYPE_MISMATCH!>c<!>)
|
||||
checkSubtype<java.lang.Comparable<*>>(c)
|
||||
}
|
||||
checkSubtype<<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<*><!>>(c)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !CHECK_TYPE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<!> as Comparable
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// JAVAC_EXPECTED_FILE
|
||||
// KT-498 Very strange error in the type checker
|
||||
|
||||
class IdUnavailableException() : Exception() {}
|
||||
|
||||
fun <T : Any> T.getJavaClass() : Class<T> {
|
||||
return ((this as Object).getClass()) <!UNCHECKED_CAST!>as Class<T><!> // Some error here, because of Exception() used above. ?!!!
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
// JAVAC_EXPECTED_FILE
|
||||
// KT-498 Very strange error in the type checker
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// KT-716 Type inference failed
|
||||
|
||||
class TypeInfo<T>
|
||||
|
||||
fun <T> typeinfo() : TypeInfo<T> = null <!CAST_NEVER_SUCCEEDS!>as<!> TypeInfo<T>
|
||||
|
||||
fun <T> TypeInfo<T>.getJavaClass() : java.lang.Class<T> {
|
||||
val t : java.lang.Object = this as java.lang.Object
|
||||
return t.getClass() <!UNCHECKED_CAST!>as java.lang.Class<T><!> // inferred type is Object but Serializable was expected
|
||||
}
|
||||
|
||||
fun <T> getJavaClass() = typeinfo<T>().getJavaClass()
|
||||
|
||||
fun main() {
|
||||
System.out.println(getJavaClass<String>())
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
// KT-716 Type inference failed
|
||||
|
||||
class TypeInfo<T>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
fun foo(p: java.util.List<String>) {
|
||||
p.iterator(); // forcing resolve of java.util.List.iterator()
|
||||
|
||||
ArrayList<String>().iterator(); // this provoked exception in SignaturesPropagationData
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
import java.util.ArrayList
|
||||
|
||||
fun foo(p: <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<String><!>) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// JAVAC_EXPECTED_FILE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
//FILE:a.kt
|
||||
package a
|
||||
|
||||
@@ -44,6 +46,6 @@ class Q {
|
||||
}
|
||||
|
||||
//check that 'toString' can be invoked without specifying return type
|
||||
class NewClass : java.util.ArrayList<Integer>() {
|
||||
public override fun toString() = "a"
|
||||
class NewClass : java.util.ArrayList<<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Integer<!>>() {
|
||||
<!REDUNDANT_VISIBILITY_MODIFIER!>public<!> override fun toString() = "a"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// JAVAC_EXPECTED_FILE
|
||||
// WITH_EXTENDED_CHECKERS
|
||||
|
||||
//FILE:a.kt
|
||||
package a
|
||||
|
||||
|
||||
Reference in New Issue
Block a user