[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:
@@ -2,6 +2,8 @@
|
||||
//KT-1778 Automatically cast error
|
||||
package kt1778
|
||||
|
||||
import checkSubtype
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val x = checkSubtype<Any>(args[0])
|
||||
if(x is java.lang.CharSequence) {
|
||||
@@ -9,4 +11,4 @@ fun main(args : Array<String>) {
|
||||
if ("a" == x || "b" == x) x.<!UNRESOLVED_REFERENCE!>length<!> else x.length() // <– THEN ERROR
|
||||
if ("a" == x && "a" == x) x.<!UNRESOLVED_REFERENCE!>length<!> else x.length() // <– ELSE ERROR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//KT-1778 Automatically cast error
|
||||
package kt1778
|
||||
|
||||
import checkSubtype
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val x = checkSubtype<Any>(args[0])
|
||||
if(x is <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.CharSequence<!>) {
|
||||
@@ -9,4 +11,4 @@ fun main(args : Array<String>) {
|
||||
if ("a" == x || "b" == x) <!DEBUG_INFO_SMARTCAST!>x<!>.length else <!DEBUG_INFO_SMARTCAST!>x<!>.length() // <– THEN ERROR
|
||||
if ("a" == x && "a" == x) <!DEBUG_INFO_SMARTCAST!>x<!>.length else <!DEBUG_INFO_SMARTCAST!>x<!>.length() // <– ELSE ERROR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
//KT-2176 non-nullability is not inferred after !! or "as"
|
||||
package kt2176
|
||||
|
||||
import checkSubtype
|
||||
|
||||
fun f1(a: String?) {
|
||||
a!!
|
||||
checkSubtype<String>(a)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
//KT-2176 non-nullability is not inferred after !! or "as"
|
||||
package kt2176
|
||||
|
||||
import checkSubtype
|
||||
|
||||
fun f1(a: String?) {
|
||||
a!!
|
||||
checkSubtype<String>(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
package a
|
||||
|
||||
import checkSubtype
|
||||
|
||||
//KT-2234 'period!!' has type Int?
|
||||
|
||||
class Pair<A, B>(val a: A, val b: B)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
package a
|
||||
|
||||
import checkSubtype
|
||||
|
||||
//KT-2234 'period!!' has type Int?
|
||||
|
||||
class Pair<A, B>(val a: A, val b: B)
|
||||
|
||||
Reference in New Issue
Block a user