Rename conflicting repeat function with the same behavior from js tests.

This commit is contained in:
Ilya Gorbunov
2015-05-26 15:23:40 +03:00
parent 310666a617
commit 1566ea83c7
4 changed files with 15 additions and 15 deletions
@@ -5,7 +5,7 @@ package foo
data class State(var count: Int = 0) data class State(var count: Int = 0)
inline fun repeat(times: Int, action: () -> Unit) { inline fun repeatAction(times: Int, action: () -> Unit) {
for (i in 1..times) { for (i in 1..times) {
action() action()
} }
@@ -16,7 +16,7 @@ fun capturedInLambda(state: State, a: Int, b: Int): Int {
count++ count++
} }
repeat(a + b) { repeatAction(a + b) {
state.inc() state.inc()
} }
@@ -25,12 +25,12 @@ fun capturedInLambda(state: State, a: Int, b: Int): Int {
fun declaredInLambda(state: State, a: Int, b: Int): Int { fun declaredInLambda(state: State, a: Int, b: Int): Int {
repeat(a) { repeatAction(a) {
[inline] fun State.inc() { [inline] fun State.inc() {
count++ count++
} }
repeat(b) { repeatAction(b) {
state.inc() state.inc()
} }
} }
@@ -3,7 +3,7 @@ package foo
// CHECK_CONTAINS_NO_CALLS: localWithCapture // CHECK_CONTAINS_NO_CALLS: localWithCapture
// CHECK_CONTAINS_NO_CALLS: localWithoutCapture // CHECK_CONTAINS_NO_CALLS: localWithoutCapture
inline fun repeat(times: Int, action: () -> Unit) { inline fun repeatAction(times: Int, action: () -> Unit) {
for (i in 1..times) { for (i in 1..times) {
action() action()
} }
@@ -16,7 +16,7 @@ fun localWithoutCapture(a: Int, b: Int): Int {
return x + 1 return x + 1
} }
repeat(a + b) { repeatAction(a + b) {
sum = inc(sum) sum = inc(sum)
} }
@@ -30,7 +30,7 @@ fun localWithCapture(a: Int, b: Int): Int {
sum++ sum++
} }
repeat(a + b) { repeatAction(a + b) {
inc() inc()
} }
@@ -4,7 +4,7 @@ package foo
data class State(var count: Int = 0) data class State(var count: Int = 0)
inline fun repeat(times: Int, action: () -> Unit) { inline fun repeatAction(times: Int, action: () -> Unit) {
for (i in 1..times) { for (i in 1..times) {
action() action()
} }
@@ -19,12 +19,12 @@ fun add(state: State, a: Int, b: Int): Int {
return inc(a) return inc(a)
} }
repeat(a) { repeatAction(a) {
[inline] fun inc2(a: Int): Int { [inline] fun inc2(a: Int): Int {
return inc1(a) return inc1(a)
} }
repeat(b) { repeatAction(b) {
[inline] fun State.inc() { [inline] fun State.inc() {
count = inc2(count) count = inc2(count)
} }
@@ -3,7 +3,7 @@ package foo
// CHECK_CONTAINS_NO_CALLS: localWithCapture // CHECK_CONTAINS_NO_CALLS: localWithCapture
// CHECK_CONTAINS_NO_CALLS: localWithoutCapture // CHECK_CONTAINS_NO_CALLS: localWithoutCapture
inline fun repeat(times: Int, action: () -> Unit) { inline fun repeatAction(times: Int, action: () -> Unit) {
for (i in 1..times) { for (i in 1..times) {
action() action()
} }
@@ -12,12 +12,12 @@ inline fun repeat(times: Int, action: () -> Unit) {
fun localWithoutCapture(a: Int, b: Int): Int { fun localWithoutCapture(a: Int, b: Int): Int {
var mult = 0 var mult = 0
repeat(a) { repeatAction(a) {
[inline] fun inc(x: Int): Int { [inline] fun inc(x: Int): Int {
return x + 1 return x + 1
} }
repeat(b) { repeatAction(b) {
mult = inc(mult) mult = inc(mult)
} }
} }
@@ -28,12 +28,12 @@ fun localWithoutCapture(a: Int, b: Int): Int {
fun localWithCapture(a: Int, b: Int): Int { fun localWithCapture(a: Int, b: Int): Int {
var mult = 0 var mult = 0
repeat(a) { repeatAction(a) {
[inline] fun inc() { [inline] fun inc() {
mult++ mult++
} }
repeat(b) { repeatAction(b) {
inc() inc()
} }
} }