// See also KT-7804 (Wrong type inference of kotlin.Any? was for 'a' without explicit type) fun foo(a: T) = a class A fun test(v: T): T { val a = if (v !is A) { foo(v) as T } else { v } val t: T = a return t } fun test2(v: T): T { val a = if (v !is A) { foo(v) as T } else { v as T } val t: T = a return t } fun test3(v: T): T { val a = if (v !is A) { foo(v) } else { v } val t: T = a return t } fun test4(v: T): T { val a: T = if (v !is A) { foo(v) as T } else { v } val t: T = a return t } fun test5(v: T): T { val a: T = if (v !is A) { foo(v) } else { v } val t: T = a return t }