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,43 @@
// TARGET_BACKEND: JVM
// FILE: A.java
// ANDROID_ANNOTATIONS
import kotlin.annotations.jvm.internal.*;
class A {
public int first(@DefaultValue("1") int a, @DefaultValue("2") int b) {
return 100 * a + b;
}
public int second(int a, @DefaultValue("42") int b) {
return 100 * a + b;
}
}
// FILE: main.kt
fun box(): String {
val a = A()
if (a.first() != 102) {
return "FAIL 1"
}
if (a.first(2) != 202) {
return "FAIL 2"
}
if (a.first(3, 4) != 304) {
return "FAIL 3"
}
if (a.second(7, 8) != 708) {
return "FAIL 4"
}
if (a.second(1) != 142) {
return "FAIL 5"
}
return "OK"
}