Add annotation for default parameter value

This commit is contained in:
Leonid Stashevsky
2017-10-04 14:03:23 +03:00
parent 62e87c873c
commit 0348561cd2
48 changed files with 1827 additions and 39 deletions
@@ -0,0 +1,37 @@
// TARGET_BACKEND: JVM
// FILE: A.java
// ANDROID_ANNOTATIONS
import kotlin.annotations.jvm.internal.*;
class A {
public int first(
@ParameterName("first") @DefaultValue("42") int a,
@ParameterName("second") @DefaultValue("1") int b
) {
return 100 * a + b;
}
}
// FILE: main.kt
fun box(): String {
val a = A()
if (a.first() != 100 * 42 + 1) {
return "FAIL 1"
}
if (a.first(second = 2) != 100 * 42 + 2) {
return "FAIL 2"
}
if (a.first(first = 2) != 100 * 2 + 1) {
return "FAIL 3"
}
if (a.first(second = 2, first = 5) != 100 * 5 + 2) {
return "FAIL 4"
}
return "OK"
}