diff --git a/vlib/v/checker/tests/unfinished_string.out b/vlib/v/checker/tests/unfinished_string.out new file mode 100644 index 0000000000..c42f70aea2 --- /dev/null +++ b/vlib/v/checker/tests/unfinished_string.out @@ -0,0 +1,2 @@ +vlib/v/checker/tests/unfinished_string.vv:2:1: error: unfinished string literal + 1 | a := ' diff --git a/vlib/v/checker/tests/unfinished_string.vv b/vlib/v/checker/tests/unfinished_string.vv new file mode 100644 index 0000000000..e6374fb3ab --- /dev/null +++ b/vlib/v/checker/tests/unfinished_string.vv @@ -0,0 +1 @@ +a := ' diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index 90b90a220c..1a49d5ee31 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -1193,7 +1193,7 @@ fn (mut s Scanner) ident_string() string { for { s.pos++ if s.pos >= s.text.len { - break + s.error('unfinished string literal') } c := s.text[s.pos] prevc := s.text[s.pos - 1]