Disallow named arguments for Java methods

Since they don't have stable names: they're (sometimes) loaded from the
bytecode, which (sometimes) doesn't contain parameter names
This commit is contained in:
Alexander Udalov
2014-03-19 17:57:18 +04:00
parent 5fa1774cc1
commit 1c5df773c5
10 changed files with 74 additions and 33 deletions
@@ -0,0 +1,27 @@
fun foo(<!UNUSED_PARAMETER!>a<!> : Int = 1, <!UNUSED_PARAMETER!>b<!> : String = "abc") {
}
fun bar(<!UNUSED_PARAMETER!>x<!> : Int = 1, <!UNUSED_PARAMETER!>y<!> : Int = 1, <!UNUSED_PARAMETER!>z<!> : String) {
}
fun test() {
foo()
foo(2)
foo(<!TYPE_MISMATCH!>""<!>)
foo(b = "")
foo(1, "")
foo(a = 2)
foo(1, "", <!TOO_MANY_ARGUMENTS!>""<!>)
bar(z = "")
bar(<!NO_VALUE_FOR_PARAMETER!>)<!>
bar(<!TYPE_MISMATCH!>""<!><!NO_VALUE_FOR_PARAMETER!>)<!>
bar(1, 1, "")
bar(1, 1, "")
bar(1, z = "")
bar(1, z = "", y = 2)
bar(z = "", <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>1<!>)
bar(1, <!NAMED_PARAMETER_NOT_FOUND!>zz<!> = "",
<!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!><!UNRESOLVED_REFERENCE!>zz<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>foo<!><!>
<!NO_VALUE_FOR_PARAMETER!>)<!>
}