From 68dab101d9118843bd4a645158735bee2b913f3f Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 28 Jan 2021 11:05:37 +0100 Subject: [PATCH] checker: fix one letter receiver panic --- vlib/v/checker/checker.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 4eefbee119..f95d7d9c2e 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -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) // }