Replace deprecated annotations with modifiers in testData

This commit is contained in:
Denis Zharkov
2015-09-17 13:04:46 +03:00
parent 4850fd10f0
commit 9dada595b6
18 changed files with 39 additions and 35 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
fun test1(str: String): String {
@data class A(val x: Int) {
data class A(val x: Int) {
fun foo() = str
}
return A(0).copy().foo()
@@ -7,7 +7,7 @@ fun test1(str: String): String {
class TestClass(val x: String) {
fun foo(): String {
@data class A(val x: Int) {
data class A(val x: Int) {
fun foo() = this@TestClass.x
}
return A(0).copy().foo()
@@ -18,7 +18,7 @@ fun test2(str: String): String = TestClass(str).foo()
fun test3(str: String): String {
var xx = ""
@data class A(val x: Int) {
data class A(val x: Int) {
fun foo(): String { xx = str; return xx }
}
return A(0).copy().foo()
@@ -27,7 +27,7 @@ fun test3(str: String): String {
fun test4(str: String): String {
var xx = ""
fun bar(s: String): String { xx = s; return xx }
@data class A(val x: Int) {
data class A(val x: Int) {
fun foo(): String = bar(str)
}
return A(0).copy().foo()
+1 -1
View File
@@ -3,7 +3,7 @@ package t
class Reproduce {
fun test(): String {
@data class Foo(val bar: String, val baz: Int)
data class Foo(val bar: String, val baz: Int)
val foo = Foo("OK", 5)
return foo.bar
}
+1 -1
View File
@@ -4,7 +4,7 @@ enum class MyEnum {
K;
//TODO: KT-4693
@inline fun <T> doSmth(a: T) : String {
inline fun <T> doSmth(a: T) : String {
return a.toString() + K.name()
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
// expected: rv: 2
@inline fun foo(l: (Int) -> Int ): Int {
inline fun foo(l: (Int) -> Int ): Int {
return l(1)
}
@@ -9,7 +9,7 @@ class A @Ann(1)private constructor(x: Int) {
inner class B() // do not insert here
inner class C protected constructor() {
fun foo() {
@data class Local private constructor()
data class Local private constructor()
}
}
}
@@ -9,7 +9,7 @@ class A @Ann(1)<caret>private (x: Int) {
inner class B() // do not insert here
inner class C protected () {
fun foo() {
@data class Local private()
data class Local private()
}
}
}
@@ -1,7 +1,7 @@
// "Update obsolete label syntax in whole project" "true"
// ERROR: Unresolved reference: @abc
// ERROR: Unresolved reference: @ann
// ERROR: Unresolved reference: @cde
// ERROR: Unresolved reference: @data
// ERROR: Unresolved reference: @labeled
// ERROR: Unresolved reference: @loop
// ERROR: Unresolved reference: @loop2
@@ -22,8 +22,8 @@
// ERROR: Unresolved reference: notLabelAnnotation
// ERROR: Unresolved reference: notLoop
// ERROR: The label '@abc' does not denote a loop
// ERROR: The label '@ann' does not denote a loop
// ERROR: The label '@cde' does not denote a loop
// ERROR: The label '@data' does not denote a loop
// ERROR: The label '@loop' does not denote a loop
// ERROR: The label '@loop2' does not denote a loop
// ERROR: The label '@loop3' does not denote a loop
@@ -32,6 +32,8 @@
fun run(block: () -> Unit) = block()
annotation class ann
notLabelAnnotation class A {
fun foo() {
loop@
@@ -64,8 +66,8 @@ notLabelAnnotation class A {
return@labeled
}
@data for (i in 1..100) {
continue@data
@ann for (i in 1..100) {
continue@ann
}
@ for (i in 1..100) {
@@ -1,7 +1,7 @@
// "Update obsolete label syntax in whole project" "true"
// ERROR: Unresolved reference: @abc
// ERROR: Unresolved reference: @ann
// ERROR: Unresolved reference: @cde
// ERROR: Unresolved reference: @data
// ERROR: Unresolved reference: @labeled
// ERROR: Unresolved reference: @loop
// ERROR: Unresolved reference: @loop2
@@ -22,8 +22,8 @@
// ERROR: Unresolved reference: notLabelAnnotation
// ERROR: Unresolved reference: notLoop
// ERROR: The label '@abc' does not denote a loop
// ERROR: The label '@ann' does not denote a loop
// ERROR: The label '@cde' does not denote a loop
// ERROR: The label '@data' does not denote a loop
// ERROR: The label '@loop' does not denote a loop
// ERROR: The label '@loop2' does not denote a loop
// ERROR: The label '@loop3' does not denote a loop
@@ -32,6 +32,8 @@
fun run(block: () -> Unit) = block()
annotation class ann
notLabelAnnotation class A {
fun foo() {
@loop<caret>
@@ -64,8 +66,8 @@ notLabelAnnotation class A {
return@labeled
}
@data for (i in 1..100) {
continue@data
@ann for (i in 1..100) {
continue@ann
}
@ for (i in 1..100) {
@@ -2,7 +2,7 @@ package foo
fun add(a: Int, b: Int): Int {
val o = object {
@inline fun add(a: Int, b: Int): Int = a + b
inline fun add(a: Int, b: Int): Int = a + b
}
return o.add(a, b)
@@ -1,7 +1,7 @@
package foo
fun multiplyBy(x: Int): () -> ((Int) -> Int) {
@inline fun applyMultiplication(y: Int): Int = x * y
inline fun applyMultiplication(y: Int): Int = x * y
return { ::applyMultiplication }
}
@@ -12,7 +12,7 @@ internal inline fun repeatAction(times: Int, action: () -> Unit) {
}
internal fun capturedInLambda(state: State, a: Int, b: Int): Int {
@inline fun State.inc() {
inline fun State.inc() {
count++
}
@@ -26,7 +26,7 @@ internal fun capturedInLambda(state: State, a: Int, b: Int): Int {
internal fun declaredInLambda(state: State, a: Int, b: Int): Int {
repeatAction(a) {
@inline fun State.inc() {
inline fun State.inc() {
count++
}
@@ -12,7 +12,7 @@ internal inline fun repeatAction(times: Int, action: () -> Unit) {
internal fun localWithoutCapture(a: Int, b: Int): Int {
var sum = 0
@inline fun inc(x: Int): Int {
inline fun inc(x: Int): Int {
return x + 1
}
@@ -26,7 +26,7 @@ internal fun localWithoutCapture(a: Int, b: Int): Int {
internal fun localWithCapture(a: Int, b: Int): Int {
var sum = 0
@inline fun inc() {
inline fun inc() {
sum++
}
@@ -11,21 +11,21 @@ internal inline fun repeatAction(times: Int, action: () -> Unit) {
}
internal fun add(state: State, a: Int, b: Int): Int {
@inline fun inc(a: Int): Int {
inline fun inc(a: Int): Int {
return a + 1
}
@inline fun inc1(a: Int): Int {
inline fun inc1(a: Int): Int {
return inc(a)
}
repeatAction(a) {
@inline fun inc2(a: Int): Int {
inline fun inc2(a: Int): Int {
return inc1(a)
}
repeatAction(b) {
@inline fun State.inc() {
inline fun State.inc() {
count = inc2(count)
}
@@ -13,7 +13,7 @@ internal fun localWithoutCapture(a: Int, b: Int): Int {
var mult = 0
repeatAction(a) {
@inline fun inc(x: Int): Int {
inline fun inc(x: Int): Int {
return x + 1
}
@@ -29,7 +29,7 @@ internal fun localWithCapture(a: Int, b: Int): Int {
var mult = 0
repeatAction(a) {
@inline fun inc() {
inline fun inc() {
mult++
}
@@ -9,7 +9,7 @@ internal inline fun run(action: () -> Int): Int {
internal fun add(a: Int, b: Int): Int {
var sum = a + b
@inline fun getSum(): Int {
inline fun getSum(): Int {
return sum
}
@@ -1,7 +1,7 @@
package foo
fun multiplyBy(a: Int): (Int) -> Int {
@inline fun multiply(b: Int): Int = a * b
inline fun multiply(b: Int): Int = a * b
return ::multiply
}
+1 -1
View File
@@ -9,7 +9,7 @@ enum class MyEnum {
K;
//TODO: KT-4693
@inline fun <T> doSmth(a: T) : String {
inline fun <T> doSmth(a: T) : String {
return a.toString() + K.name()
}
}
@@ -9,9 +9,9 @@ class State() {
}
internal fun test(state: State) {
@inline fun test3() {
@inline fun test2() {
@inline fun test1() {
inline fun test3() {
inline fun test2() {
inline fun test1() {
loop@ for (i in 1..10) {
state.value++
if (i == 2) break@loop