declare interface A {
f?();
}
declare class B {
f?();
}
The following code will be generated:
external interface A {
val f: (() -> Unit)?
get() = definedExternally
}
external open class B {
open fun f()
}
As I believe, in classes we should generate the same lambda property.
I think, this distinction is because of distinctions in our parser: methods in classes are parsed as FunctionDeclaration, while methods in interface are parsed as MethodSignatureDeclaration. In fact, our class FunctionDeclaration doesn't even have flag optional.
I've added better-translation tag since this snippet of code is still compiling - however I'm almost convinced that in some scenarios this can have more dire consequences.
Consider following declarations:
The following code will be generated:
As I believe, in classes we should generate the same lambda property.
I think, this distinction is because of distinctions in our parser: methods in classes are parsed as
FunctionDeclaration
, while methods in interface are parsed asMethodSignatureDeclaration
. In fact, our classFunctionDeclaration
doesn't even have flagoptional
.