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)