Tests for shadowing and redeclaration

This commit is contained in:
Nikolay Krasko
2013-10-23 17:26:40 +04:00
parent d6821ebfb6
commit 669104538d
3 changed files with 55 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
val <error>a</error> : Int = 1
val <error>a</error> : Int = 1
<error>fun foo()</error> {}
<error>fun foo()</error> {}
enum class EnumClass {
<error>FOO</error>
<error>FOO</error>
}
class A {
val <error>a</error> : Int = 1
val <error>a</error> : Int = 1
<error>fun foo()</error> {}
<error>fun foo()</error> {}
}
object B {
class <error>C</error>
class <error>C</error>
}
fun PairParam<<error>T</error>, <error>T</error>>() {}
class PParam<<error>T</error>, <error>T</error>> {}
val <<error>T</error>, <error>T</error>> T.fooParam : Int = 1
+17
View File
@@ -0,0 +1,17 @@
class A {
fun component1() = 42
fun component2() = 42
}
fun foo(a: A, <warning>c</warning>: Int) {
val (<warning descr="[NAME_SHADOWING] Name shadowed: a"><warning descr="[UNUSED_VARIABLE] Variable 'a' is never used">a</warning></warning>, <warning>b</warning>) = a
val arr = Array(2) { A() }
for ((<warning descr="[NAME_SHADOWING] Name shadowed: c">c</warning>, d) in arr) {
}
}
fun f(<warning>p</warning>: Int): Int {
val <error>p</error> = 2
val <error>p</error> = 3
return p
}