1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: support typeof(x).idx, as well as iface.type_idx() (#11178)

This commit is contained in:
Delyan Angelov
2021-08-14 17:22:25 +03:00
committed by GitHub
parent 8dc043ba2c
commit deb26b92b9
5 changed files with 183 additions and 21 deletions

View File

@@ -514,8 +514,8 @@ fn (mut p Parser) interface_decl() ast.InterfaceDecl {
line_nr := p.tok.line_nr
name := p.check_name()
if name == 'type_name' {
p.error_with_pos('cannot override built-in method `type_name`', method_start_pos)
if name in ['type_name', 'type_idx'] {
p.error_with_pos('cannot override built-in method `$name`', method_start_pos)
return ast.InterfaceDecl{}
}
if ts.has_method(name) {