JS frontend: additional check for nativeSetter -- check that the return type is either Unit or a supertype of the second parameter's type.
This commit is contained in:
+11
-2
@@ -11,6 +11,12 @@ fun foo() {
|
||||
|
||||
nativeSetter
|
||||
fun foo(a: Int, v: String) {}
|
||||
|
||||
nativeSetter
|
||||
fun set4(a: Double, v: String): Any = 1
|
||||
|
||||
nativeSetter
|
||||
fun set5(a: Double, v: String): CharSequence = "OK"
|
||||
}
|
||||
|
||||
[native]
|
||||
@@ -25,10 +31,13 @@ fun foo() {
|
||||
fun Int.set(a: String, v: Int)<!> {}
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
|
||||
fun Int.set2(a: Number, v: String?)<!> = "OK"
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set2<!>(a: Number, v: String?)<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
|
||||
fun Int.set3(a: Double, v: String?)<!> = "OK"
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set3<!>(a: Double, v: String?)<!> = "OK"
|
||||
|
||||
nativeSetter
|
||||
fun set6(a: Double, v: String): <!NATIVE_SETTER_WRONG_RETURN_TYPE!>Number<!> = 1
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>nativeSetter
|
||||
fun set(): Any?<!> = null
|
||||
|
||||
Reference in New Issue
Block a user