From cfcc57f5d326aef5d50f934af5c80a7315dcea4f Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 13 Sep 2021 18:14:26 +0300 Subject: [PATCH] checker: remove unnecessary "no methods" error; builder: skip float.c.v with -nofloat --- vlib/builtin/float.c.v | 2 ++ vlib/v/checker/checker.v | 4 +++- vlib/v/pref/should_compile.v | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/vlib/builtin/float.c.v b/vlib/builtin/float.c.v index 99fe8b8c09..2d8d30a286 100644 --- a/vlib/builtin/float.c.v +++ b/vlib/builtin/float.c.v @@ -2,6 +2,8 @@ // Use of this source code is governed by an MIT license that can be found in the LICENSE file. module builtin +// TODO implement compile time conditional include +// [if !nofloat] import strconv #include diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index a3c5606217..93765a1332 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -2144,7 +2144,9 @@ pub fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type { } } if left_type == ast.void_type { - c.error('`void` type has no methods', node.left.position()) + // No need to print this error, since this means that the variable is unknown, + // and there already was an error before. + // c.error('`void` type has no methods', node.left.position()) return ast.void_type } mut has_generic := false // x.foo() instead of x.foo() diff --git a/vlib/v/pref/should_compile.v b/vlib/v/pref/should_compile.v index 6eec8d0ad3..09cc1ce0cf 100644 --- a/vlib/v/pref/should_compile.v +++ b/vlib/v/pref/should_compile.v @@ -30,6 +30,9 @@ pub fn (prefs &Preferences) should_compile_filtered_files(dir string, files_ []s if file.starts_with('.#') { continue } + if prefs.nofloat && file.ends_with('float.c.v') { + continue + } if file.contains('_d_') { if prefs.compile_defines_all.len == 0 { continue