Tests for 'suppress' annotation

This commit is contained in:
Andrey Breslav
2013-09-17 19:28:43 +04:00
parent 1dff2fcf36
commit 2dfaa81995
25 changed files with 265 additions and 3 deletions
@@ -0,0 +1,7 @@
suppress("warnings")
class C {
fun foo(p: String??) {
// Make sure errors are not suppressed:
<!VAL_REASSIGNMENT!>p<!> = ""
}
}
@@ -0,0 +1,6 @@
class C {
suppress("warnings")
class object {
val foo: String?? = null as Nothing?
}
}
@@ -0,0 +1,4 @@
class C {
suppress("warnings")
fun foo(p: String??) {}
}
@@ -0,0 +1,4 @@
suppress("warnings")
object C {
fun foo(p: String??) {}
}
@@ -0,0 +1,3 @@
class C {
fun foo(suppress("warnings") p: String?? = "" as String) {}
}
@@ -0,0 +1,4 @@
class C {
suppress("warnings")
val foo: String?? = null as Nothing?
}
@@ -0,0 +1,5 @@
class C {
val foo: String?
[suppress("warnings")]
get(): String?? = null as Nothing?
}
@@ -0,0 +1,5 @@
suppress("REDUNDANT_NULLABLE")
class C {
suppress("UNNECESSARY_NOT_NULL_ASSERTION")
fun foo(): String?? = ""!! <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as<!> String??
}
@@ -0,0 +1,4 @@
suppress("REDUNDANT_NULLABLE", "UNNECESSARY_NOT_NULL_ASSERTION")
class C {
fun foo(): String?? = ""!! <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as<!> String??
}
@@ -0,0 +1,6 @@
class C {
suppress("REDUNDANT_NULLABLE", "UNNECESSARY_NOT_NULL_ASSERTION")
class object {
val foo: String?? = ""!! <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as<!> String??
}
}
@@ -0,0 +1,4 @@
class C {
suppress("REDUNDANT_NULLABLE", "UNNECESSARY_NOT_NULL_ASSERTION")
fun foo(): String?? = ""!! <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as<!> String??
}
@@ -0,0 +1,4 @@
suppress("REDUNDANT_NULLABLE", "UNNECESSARY_NOT_NULL_ASSERTION")
object C {
fun foo(): String?? = ""!! <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as<!> String??
}
@@ -0,0 +1,3 @@
class C {
fun foo(suppress("REDUNDANT_NULLABLE", "UNNECESSARY_NOT_NULL_ASSERTION") p: String?? = ""!! <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as<!> String??) = p
}
@@ -0,0 +1,4 @@
class C {
suppress("REDUNDANT_NULLABLE", "UNNECESSARY_NOT_NULL_ASSERTION")
val foo: String?? = ""!! <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as<!> String??
}
@@ -0,0 +1,5 @@
class C {
val foo: String?
[suppress("REDUNDANT_NULLABLE", "UNNECESSARY_NOT_NULL_ASSERTION")]
get(): String?? = ""!! <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as<!> String??
}
@@ -0,0 +1,4 @@
suppress("REDUNDANT_NULLABLE")
class C {
fun foo(): String?? = null <!USELESS_CAST!>as<!> Nothing??
}
@@ -0,0 +1,6 @@
class C {
suppress("REDUNDANT_NULLABLE")
class object {
val foo: String?? = null <!USELESS_CAST!>as<!> Nothing??
}
}
@@ -0,0 +1,4 @@
class C {
suppress("REDUNDANT_NULLABLE")
fun foo(): String?? = null <!USELESS_CAST!>as<!> Nothing??
}
@@ -0,0 +1,7 @@
class C {
fun foo(): Any? {
[suppress("REDUNDANT_NULLABLE")]
val v: String?? = null <!USELESS_CAST!>as<!> Nothing??
return v
}
}
@@ -0,0 +1,4 @@
suppress("REDUNDANT_NULLABLE")
object C {
fun foo(): String?? = null <!USELESS_CAST!>as<!> Nothing??
}
@@ -0,0 +1,3 @@
class C {
fun foo(suppress("REDUNDANT_NULLABLE") p: String?? = null <!USELESS_CAST!>as<!> Nothing??) = p
}
@@ -0,0 +1,4 @@
class C {
suppress("REDUNDANT_NULLABLE")
val foo: String?? = null <!USELESS_CAST!>as<!> Nothing?
}
@@ -0,0 +1,5 @@
class C {
val foo: String?
[suppress("REDUNDANT_NULLABLE")]
get(): String?? = null <!USELESS_CAST!>as<!> Nothing??
}