diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index 1c291fc07c..854402286d 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -849,7 +849,7 @@ fn (mut s Scanner) text_scan() token.Token { return s.new_token(.and_assign, '', 2) } afternextc := s.look_ahead(2) - if nextc == `&` && afternextc.is_space() { + if nextc == `&` && (afternextc.is_space() || afternextc == `!`) { s.pos++ return s.new_token(.and, '', 2) } diff --git a/vlib/v/tests/scanner_and_and_not_test.v b/vlib/v/tests/scanner_and_and_not_test.v new file mode 100644 index 0000000000..1f07123282 --- /dev/null +++ b/vlib/v/tests/scanner_and_and_not_test.v @@ -0,0 +1,5 @@ +fn test_and_and_not_parses() { + ok1 := true + ok2 := false && !ok1 + assert ok2 == false +}