Files
kotlin-fork/compiler/testData/diagnostics/tests/AutocastsForStableIdentifiers.jet
T
Andrey Breslav 41fd43b5e5 GreatSyntacticShift: Syntax for function types, function literals, when and tuples
Bug:
fun loop(var times : Int) {
   while(times > 0) {
        val u : (value : Int) -> Unit = { // This arrow is confusing the lookahead
            System.out?.println(it)
        }
        u(times--)
   }
}
2011-12-20 22:55:25 +04:00

91 lines
1.8 KiB
Plaintext

package example;
package ns {
val y : Any? = 2
}
object Obj {
val y : Any? = 2
}
class AClass() {
class object {
val y : Any? = 2
}
}
val x : Any? = 1
fun Any?.vars(<!UNUSED_PARAMETER!>a<!>: Any?) : Int {
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>b<!>: Int = 0
if (ns.y is Int) {
b = <!UNUSED_VALUE!>ns.y<!>
}
if (ns.y is Int) {
b = <!UNUSED_VALUE!>example.ns.y<!>
}
if (example.ns.y is Int) {
b = <!UNUSED_VALUE!>ns.y<!>
}
if (example.ns.y is Int) {
b = <!UNUSED_VALUE!>example.ns.y<!>
}
// if (namespace.bottles.ns.y is Int) {
// b = ns.y
// }
if (Obj.y is Int) {
b = <!UNUSED_VALUE!>Obj.y<!>
}
if (example.Obj.y is Int) {
b = <!UNUSED_VALUE!>Obj.y<!>
}
if (AClass.y is Int) {
b = <!UNUSED_VALUE!>AClass.y<!>
}
if (example.AClass.y is Int) {
b = <!UNUSED_VALUE!>AClass.y<!>
}
if (x is Int) {
b = <!UNUSED_VALUE!>x<!>
}
if (example.x is Int) {
b = <!UNUSED_VALUE!>x<!>
}
if (example.x is Int) {
b = <!UNUSED_VALUE!>example.x<!>
}
return 1
}
fun Any?.foo() : Int {
if (this is Int)
return this
if (this@foo is Int)
return this
if (this@foo is Int)
return this@foo
if (this is Int)
return this@foo
return 1
}
trait T {}
open class C {
fun foo() {
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>t<!> : T? = null
if (this is T) {
t = <!UNUSED_VALUE!>this<!>
}
if (this is T) {
t = <!UNUSED_VALUE!>this@C<!>
}
if (this@C is T) {
t = <!UNUSED_VALUE!>this<!>
}
if (this@C is T) {
t = <!UNUSED_VALUE!>this@C<!>
}
}
}