checker: fix one letter receiver panic

pull/8391/head
Alexander Medvednikov 2021-01-28 11:05:37 +01:00
parent 36e75e5208
commit 68dab101d9
1 changed files with 5 additions and 0 deletions

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)
// }