From c1e302a38d0476adc124a358510673cfd2a528f5 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 6 Jun 2023 12:03:55 +0300 Subject: [PATCH] Revert "parser: add error for typeof(T), suggesting typeof[T]() instead" This reverts commit 692624b47c769c39782e8278244ea19edfd211fe. --- vlib/v/parser/expr.v | 3 --- vlib/v/parser/tests/typeof_typename_err.out | 5 ----- vlib/v/parser/tests/typeof_typename_err.vv | 5 ----- 3 files changed, 13 deletions(-) delete mode 100644 vlib/v/parser/tests/typeof_typename_err.out delete mode 100644 vlib/v/parser/tests/typeof_typename_err.vv diff --git a/vlib/v/parser/expr.v b/vlib/v/parser/expr.v index 109d05feab..9e61b664d6 100644 --- a/vlib/v/parser/expr.v +++ b/vlib/v/parser/expr.v @@ -223,9 +223,6 @@ fn (mut p Parser) check_expr(precedence int) !ast.Expr { } } else { p.check(.lpar) - if p.tok.kind == .name && p.tok.lit.len > 0 && p.tok.lit[0].is_capital() { - p.error_with_pos('use `typeof[T]()`, instead of `typeof(T)`', spos) - } expr := p.expr(0) p.check(.rpar) if p.tok.kind != .dot && p.tok.line_nr == p.prev_tok.line_nr { diff --git a/vlib/v/parser/tests/typeof_typename_err.out b/vlib/v/parser/tests/typeof_typename_err.out deleted file mode 100644 index 1bc8b7e534..0000000000 --- a/vlib/v/parser/tests/typeof_typename_err.out +++ /dev/null @@ -1,5 +0,0 @@ -vlib/v/parser/tests/typeof_typename_err.vv:1:29: error: use `typeof[T]()`, instead of `typeof(T)` - 1 | fn f[T]() { println("type ${typeof(T)}") } - | ~~~~~~ - 2 | f[int]() - 3 | f[string]() diff --git a/vlib/v/parser/tests/typeof_typename_err.vv b/vlib/v/parser/tests/typeof_typename_err.vv deleted file mode 100644 index dcf15f45ef..0000000000 --- a/vlib/v/parser/tests/typeof_typename_err.vv +++ /dev/null @@ -1,5 +0,0 @@ -fn f[T]() { println("type ${typeof(T)}") } -f[int]() -f[string]() - -