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

checker: fix one letter receiver panic

This commit is contained in:
Alexander Medvednikov 2021-01-28 11:05:37 +01:00
parent 36e75e5208
commit 68dab101d9

View File

@ -5284,6 +5284,11 @@ fn (mut c Checker) fn_decl(mut node ast.FnDecl) {
} else if sym.kind == .sum_type && node.name == 'type_name' {
c.error('method overrides built-in sum type method', node.pos)
}
if sym.name.len == 1 {
// One letter types are reserved for generics.
c.error('unknown type `$sym.name`', node.pos)
return
}
// if sym.has_method(node.name) {
// c.warn('duplicate method `$node.name`', node.pos)
// }