Targeting / retention for a set of standard annotations, some inapplicable annotation checks replaced with target check, some fixed tests

This commit is contained in:
Mikhail Glukhikh
2015-07-16 11:35:28 +03:00
parent a75daf85e2
commit 94a00540be
53 changed files with 213 additions and 206 deletions
@@ -6,7 +6,7 @@ inline fun <T> doNothing1(a: T): T {
return a
}
inline fun <T> doNothing2(a: T, inline f: (T) -> T): T {
inline fun <T> doNothing2(a: T, f: (T) -> T): T {
return f(a)
}
+3 -3
View File
@@ -4,7 +4,7 @@ package foo
// CHECK_CONTAINS_NO_CALLS: testIf2
// CHECK_CONTAINS_NO_CALLS: testIf3
inline fun if1(inline f: (Int) -> Int, a: Int, b: Int, c: Int): Int {
inline fun if1(f: (Int) -> Int, a: Int, b: Int, c: Int): Int {
val result = f(a)
if (result == b) {
@@ -14,7 +14,7 @@ inline fun if1(inline f: (Int) -> Int, a: Int, b: Int, c: Int): Int {
return f(c)
}
inline fun if2(inline f: (Int) -> Int, a: Int, b: Int, c: Int): Int {
inline fun if2(f: (Int) -> Int, a: Int, b: Int, c: Int): Int {
if (f(a) == b) {
return f(a)
}
@@ -22,7 +22,7 @@ inline fun if2(inline f: (Int) -> Int, a: Int, b: Int, c: Int): Int {
return f(c)
}
inline fun if3(inline f: (Int) -> Int, a: Int, b: Int, c: Int): Int {
inline fun if3(f: (Int) -> Int, a: Int, b: Int, c: Int): Int {
if (f(a) == b) {
return f(a)
} else {
+2 -2
View File
@@ -9,11 +9,11 @@ class Inline {
return x
}
public inline fun <T> identity2 (x: T, inline f: (T) -> T): T {
public inline fun <T> identity2 (x: T, f: (T) -> T): T {
return f(x)
}
public inline fun <T> identity3 (inline f: () -> T): T {
public inline fun <T> identity3 (f: () -> T): T {
return f()
}
}
@@ -2,7 +2,7 @@ package foo
// CHECK_CONTAINS_NO_CALLS: sumEven
inline fun filteredReduce(a: Array<Int>, inline predicate: (Int) -> Boolean, inline reduceFun: (Int, Int) -> Int): Int {
inline fun filteredReduce(a: Array<Int>, predicate: (Int) -> Boolean, reduceFun: (Int, Int) -> Int): Int {
var result = 0
for (element in a) {
@@ -4,7 +4,7 @@ package foo
data class Result(var value: Int = 0, var invocationCount: Int = 0)
inline fun maxBy(a: Array<Int>, inline keyFun: (Int) -> Int): Int {
inline fun maxBy(a: Array<Int>, keyFun: (Int) -> Int): Int {
var maxVal = a[0]
var maxKey = keyFun(maxVal)
@@ -30,7 +30,7 @@ inline fun test3(state: State) {
}
}
noinline fun test(state: State) {
fun test(state: State) {
test3(state)
}
@@ -8,7 +8,7 @@ class State() {
public var value: Int = 0
}
noinline fun test(state: State) {
fun test(state: State) {
@inline fun test3() {
@inline fun test2() {
@inline fun test1() {
@@ -20,7 +20,7 @@ inline fun testInline(): Int {
return c
}
noinline fun testNoinline(): Int {
fun testNoinline(): Int {
return testInline()
}
@@ -17,7 +17,7 @@ inline fun testBreak(): Int {
return i
}
noinline fun testBreakNoinline() {
fun testBreakNoinline() {
assertEquals(4, testBreak(), "break")
}
@@ -33,7 +33,7 @@ inline fun testContinue(): Int {
return sum
}
noinline fun testContinueNoinline() {
fun testContinueNoinline() {
assertEquals(6, testContinue(), "continue")
}
@@ -6,7 +6,6 @@ fun <T> _enumerate(o: T): T = noImpl
native
fun _findFirst<T>(o: Any): T = noImpl
enumerable
class Test() {
val a: Int = 100
val b: String = "s"
@@ -6,7 +6,6 @@ package foo
class X
class Y
noinline
fun doRun<R>(fn: ()->R): R = fn()
inline fun test<reified A, reified B>(x: Any, y: Any): Boolean =