Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed May 15, 2024
1 parent 9639f55 commit ea9ce59
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ fn (mut c Checker) type_implements(typ ast.Type, interface_type ast.Type, pos to
inter_sym.methods
}
// voidptr is an escape hatch, it should be allowed to be passed
if utyp != ast.voidptr_type && utyp != ast.nil_type {
if utyp != ast.voidptr_type && utyp != ast.nil_type && utyp != ast.none_type {
mut are_methods_implemented := true

// Verify methods
Expand Down
18 changes: 18 additions & 0 deletions vlib/v/tests/option_interface_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
interface TestIntf {
test()
}

struct TestStruct {
ti ?TestIntf
}

fn TestStruct.new() TestStruct {
return TestStruct{
ti: none
}
}

fn test_main() {
t := TestStruct.new()
assert t.ti == none
}

0 comments on commit ea9ce59

Please sign in to comment.