[TEST] Change semantics of CHECK_TYPE directive and update testdata
Previously helpers from checkType.kt was in special package, and
if directive was enabled then test runner (`AbstractDiagnosticTest`)
injected additional imports to test files and removed them after test
was completed.
It's very hard to support such behavior in new test infrastructure so
there was a decision about changing `CHECK_TYPE`:
1. All helpers from `checkType.kt` now stays in default package
2. `CHECK_TYPE` only adds `checkType.kt` to set of analyzed files
and don't modify their content
For test which are written in default package (most of tests actually)
there are no changes. On the other hand if there is a test where dev
want to use checkType functions in testfile with some package then he
should explicitly import functions which he needed (`checkSubtype`,
`checkType`, `_`)
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
//KT-2394 java.lang.Iterable<T> should be visible as kotlin.Iterable<out T>
|
||||
package d
|
||||
|
||||
import checkSubtype
|
||||
|
||||
fun foo(iterable: Iterable<Int>, iterator: Iterator<Int>, comparable: Comparable<Any>) {
|
||||
checkSubtype<Iterable<Any>>(iterable)
|
||||
checkSubtype<Iterator<Any>>(iterator)
|
||||
|
||||
+3
-1
@@ -5,6 +5,8 @@ package a
|
||||
import java.util.Iterator
|
||||
import 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>
|
||||
@@ -15,4 +17,4 @@ fun bar(any: Any): java.lang.Iterable<Int>? {
|
||||
}
|
||||
any as Iterator<*>
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -5,6 +5,8 @@ package a
|
||||
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): <!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<!>>
|
||||
@@ -15,4 +17,4 @@ fun bar(any: Any): <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Iterable<Int><!>
|
||||
}
|
||||
any as <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user