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