added info about smart casts to diagnostic tests

This commit is contained in:
Svetlana Isakova
2013-12-06 20:12:41 +04:00
parent 00da5fe1fb
commit c30259dfbe
116 changed files with 383 additions and 348 deletions
@@ -2,6 +2,6 @@ class C(val f : () -> Unit)
fun test(e : Any) {
if (e is C) {
(e.f)()
(<!DEBUG_INFO_AUTOCAST!>e<!>.f)()
}
}
@@ -1,13 +1,13 @@
fun f1(s: String?) {
if (s!! == "");
s : String
<!DEBUG_INFO_AUTOCAST!>s<!> : String
}
fun f2(s: Number?) {
if (s is Int);
<!TYPE_MISMATCH!>s<!> : Int
if (s as Int == 42);
s : Int
<!DEBUG_INFO_AUTOCAST!>s<!> : Int
}
fun f3(s: Number?) {
@@ -3,7 +3,7 @@ class BinOp(val operator : String) : Expr
fun test(e : Expr) {
if (e is BinOp) {
when (e.operator) {
when (<!DEBUG_INFO_AUTOCAST!>e<!>.operator) {
else -> 0
}
}
@@ -4,7 +4,7 @@ fun test(x: Any, y: Int?) {
if (x !is String) return
if (y == null) return
class Local: Base(x, y) {
class Local: Base(<!DEBUG_INFO_AUTOCAST!>x<!>, <!DEBUG_INFO_AUTOCAST!>y<!>) {
}
}
@@ -1,8 +1,8 @@
fun test(x: Any) {
if (x !is String) return
class Local(s: String = x) {
fun foo(s: String = x): String = s
class Local(s: String = <!DEBUG_INFO_AUTOCAST!>x<!>) {
fun foo(s: String = <!DEBUG_INFO_AUTOCAST!>x<!>): String = s
}
}
@@ -9,8 +9,8 @@ fun test(del: Any?) {
if (del !is Del) return
class Local {
val delegatedVal by df(del)
val delegatedVal1: Int by df(del)
val delegatedVal by df(<!DEBUG_INFO_AUTOCAST!>del<!>)
val delegatedVal1: Int by df(<!DEBUG_INFO_AUTOCAST!>del<!>)
}
}
@@ -5,7 +5,7 @@ trait D {
fun test(d: Any?) {
if (d !is D) return
class Local : D by d {
class Local : D by <!DEBUG_INFO_AUTOCAST!>d<!> {
}
}
@@ -7,12 +7,12 @@ fun test(d: Any?) {
class Local {
fun f() {
d.foo()
<!DEBUG_INFO_AUTOCAST!>d<!>.foo()
}
fun f1() = d.foo()
fun f1() = <!DEBUG_INFO_AUTOCAST!>d<!>.foo()
fun f2(): String = d.foo()
fun f2(): String = <!DEBUG_INFO_AUTOCAST!>d<!>.foo()
}
}
@@ -6,8 +6,8 @@ fun test(x: Any) {
if (y !is String) return
class Local {
{
x.length
y.length
<!DEBUG_INFO_AUTOCAST!>x<!>.length
<!DEBUG_INFO_AUTOCAST!>y<!>.length
}
}
}
@@ -2,9 +2,9 @@
fun f(a: Any?) {
if (a is B) {
class C : X(a) {
class C : X(<!DEBUG_INFO_AUTOCAST!>a<!>) {
{
a.foo()
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
}
}
}
@@ -2,11 +2,11 @@ fun test(x: Any?) {
if (x !is String) return
class C {
val v = x.length
val v = <!DEBUG_INFO_AUTOCAST!>x<!>.length
val vGet: Int
get() = x.length
get() = <!DEBUG_INFO_AUTOCAST!>x<!>.length
val s: String = x
val s: String = <!DEBUG_INFO_AUTOCAST!>x<!>
}
}
@@ -1,7 +1,7 @@
fun foo(x: Any?) {
if (x is String) {
object : Base(x) {
fun bar() = x.length
object : Base(<!DEBUG_INFO_AUTOCAST!>x<!>) {
fun bar() = <!DEBUG_INFO_AUTOCAST!>x<!>.length
}
}
}
@@ -9,7 +9,7 @@ class B : A {
}
fun foo(b: B?) : Int {
if (b == null) return 0
val o = object : A by b { //no info about b not null check
val o = object : A by <!DEBUG_INFO_AUTOCAST!>b<!> { //no info about b not null check
}
return o.foo()
}
@@ -4,7 +4,7 @@ fun test(x: Any) {
class LocalOuter {
inner class Local {
{
x.length
<!DEBUG_INFO_AUTOCAST!>x<!>.length
}
}
}
@@ -2,7 +2,7 @@ open class X(val s: String)
fun f(a: String?) {
if (a != null) {
object : X(a) { // Type mismatch: inferred type is jet.String? but jet.String was expected
object : X(<!DEBUG_INFO_AUTOCAST!>a<!>) { // Type mismatch: inferred type is jet.String? but jet.String was expected
}
}
}