checker: fix notice of eval.infix.v on windows (#12770)
parent
9b4329d2f6
commit
ed4ecae57d
|
@ -5,6 +5,7 @@ module checker
|
||||||
|
|
||||||
import v.ast
|
import v.ast
|
||||||
import v.token
|
import v.token
|
||||||
|
import os
|
||||||
|
|
||||||
// TODO: promote(), check_types(), symmetric_check() and check() overlap - should be rearranged
|
// 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 {
|
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
|
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 {
|
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() {
|
if !left_type.is_int() {
|
||||||
left_sym := c.table.get_type_symbol(left_type)
|
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_sym_final := c.table.get_final_type_symbol(left_type)
|
||||||
left_type_final := ast.Type(left_sym_final.idx)
|
left_type_final := ast.Type(left_sym_final.idx)
|
||||||
if node.op == .left_shift && left_type_final.is_signed() && !(c.inside_unsafe
|
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',
|
c.note('shifting a value from a signed type `$left_sym_final.name` can change the sign',
|
||||||
node.left.position())
|
node.left.position())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue