From ed4ecae57d744950eb6e0ed5eb982b8a1a59048b Mon Sep 17 00:00:00 2001 From: yuyi Date: Fri, 10 Dec 2021 21:28:32 +0800 Subject: [PATCH] checker: fix notice of eval.infix.v on windows (#12770) --- vlib/v/checker/check_types.v | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v index 350dfe5b83..1129d4c1ee 100644 --- a/vlib/v/checker/check_types.v +++ b/vlib/v/checker/check_types.v @@ -5,6 +5,7 @@ module checker import v.ast import v.token +import os // TODO: promote(), check_types(), symmetric_check() and check() overlap - should be rearranged pub fn (mut c Checker) check_types(got ast.Type, expected ast.Type) bool { @@ -244,6 +245,10 @@ pub fn (mut c Checker) check_matching_function_symbols(got_type_sym &ast.TypeSym return true } +// TODO: remove this exception, by using a more general mechanism for opting out +// generated code, from warnings/notices, that are targeted at humans: +const infix_v_exception = os.join_path('vlib', 'v', 'eval', 'infix.v') + fn (mut c Checker) check_shift(mut node ast.InfixExpr, left_type ast.Type, right_type ast.Type) ast.Type { if !left_type.is_int() { left_sym := c.table.get_type_symbol(left_type) @@ -303,7 +308,7 @@ fn (mut c Checker) check_shift(mut node ast.InfixExpr, left_type ast.Type, right left_sym_final := c.table.get_final_type_symbol(left_type) left_type_final := ast.Type(left_sym_final.idx) if node.op == .left_shift && left_type_final.is_signed() && !(c.inside_unsafe - && c.file.path.contains('vlib/v/eval/infix.v')) { + && c.file.path.ends_with(checker.infix_v_exception)) { c.note('shifting a value from a signed type `$left_sym_final.name` can change the sign', node.left.position()) }