diff --git a/compiler/repl.v b/compiler/repl.v index 814801600c..776cb0e9ed 100644 --- a/compiler/repl.v +++ b/compiler/repl.v @@ -22,7 +22,7 @@ fn (r mut Repl) checks(line string) bool { was_indent := r.indent > 0 for i := 0; i < line.len; i++ { - if line[i] == `\'` && (i != 0 && line[i - 1] != `\\`) { + if line[i] == `\'` && (i == 0 || line[i - 1] != `\\`) { in_string = !in_string } if line[i] == `{` && !in_string { diff --git a/compiler/tests/repl/naked_strings.repl b/compiler/tests/repl/naked_strings.repl index 3769ccc964..ba6fc474c7 100644 --- a/compiler/tests/repl/naked_strings.repl +++ b/compiler/tests/repl/naked_strings.repl @@ -1,5 +1,9 @@ 'abc' 'abc'+'xyz' +'{' +'}' ===output=== abc abcxyz +{ +}