cgen: fix interface only declare with optional method (#10546)
parent
500b48788e
commit
e8a1e9d88f
|
@ -1332,6 +1332,12 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
|||
ast.Import {}
|
||||
ast.InterfaceDecl {
|
||||
// definitions are sorted and added in write_types
|
||||
for method in node.methods {
|
||||
if method.return_type.has_flag(.optional) {
|
||||
// Register an optional if it's not registered yet
|
||||
g.register_optional(method.return_type)
|
||||
}
|
||||
}
|
||||
}
|
||||
ast.Module {
|
||||
// g.is_builtin_mod = node.name == 'builtin'
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
interface Message {
|
||||
serialize() ?[]byte
|
||||
}
|
||||
|
||||
fn test_interface_only_decl_with_optional() {
|
||||
println('test interface')
|
||||
assert true
|
||||
}
|
Loading…
Reference in New Issue