Report 'free function called as extension' on Function subclasses

You can't make a value of some type invokable as an extension by adding
'extension' annotation to the type
This commit is contained in:
Alexander Udalov
2015-05-26 17:34:43 +03:00
parent 596d378962
commit 12a6461006
3 changed files with 28 additions and 3 deletions
@@ -1,3 +1,13 @@
fun foo(a: (String) -> Unit) {
"".<!FREE_FUNCTION_CALLED_AS_EXTENSION!>a<!>()
}
interface A : (String) -> Unit {}
fun foo(a: @extension A) {
// @extension annotation on an unrelated type shouldn't have any effect on this diagnostic.
// Only kotlin.Function{n} type annotated with @extension should
"".<!FREE_FUNCTION_CALLED_AS_EXTENSION!>a<!>()
}