authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-28 14:19:08-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-28 14:19:08-07:00
log52b3daa90ee41ba7e059331cf7541eb8570ec236
treefd92ea0a7fc3b7a15f1d22f74ff3facb38d5d1d7
parent9de2c1b76e2b38e35bb17cd0a3943a61c730da76

stage1: get test-compile-errors passing again


2 files changed, 8 insertions(+), 5 deletions(-)

src/stage1/tokenizer.cpp+4-1
...@@ -747,6 +747,9 @@ void tokenize(const char *source, Tokenization *out) {...@@ -747,6 +747,9 @@ void tokenize(const char *source, Tokenization *out) {
747 case 'u':747 case 'u':
748 t.state = TokenizeState_char_literal_unicode_escape_saw_u;748 t.state = TokenizeState_char_literal_unicode_escape_saw_u;
749 break;749 break;
750 case 'U':
751 invalid_char_error(&t, c);
752 break;
750 default:753 default:
751 t.state = TokenizeState_char_literal_end;754 t.state = TokenizeState_char_literal_end;
752 break;755 break;
...@@ -785,7 +788,7 @@ void tokenize(const char *source, Tokenization *out) {...@@ -785,7 +788,7 @@ void tokenize(const char *source, Tokenization *out) {
785 break;788 break;
786 case '}':789 case '}':
787 if (seen_escape_digits == 0) {790 if (seen_escape_digits == 0) {
788 tokenize_error(&t, "missing unicode escape sequence");791 tokenize_error(&t, "empty unicode escape sequence");
789 break;792 break;
790 }793 }
791 t.state = TokenizeState_char_literal_end;794 t.state = TokenizeState_char_literal_end;
test/compile_errors.zig+4-4
...@@ -34,9 +34,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -34,9 +34,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
34 \\ const c: *S = &.{};34 \\ const c: *S = &.{};
35 \\}35 \\}
36 , &[_][]const u8{36 , &[_][]const u8{
37 "mp.zig:2:31: error: expected type '[][]const u8', found '*const struct:2:31'",37 "tmp.zig:2:31: error: expected type '[][]const u8', found '*const struct:2:31'",
38 "mp.zig:5:33: error: expected type '*[2][]const u8', found '*const struct:5:33'",38 "tmp.zig:5:33: error: expected type '*[2][]const u8', found '*const struct:5:33'",
39 "mp.zig:9:21: error: expected type '*S', found '*const struct:9:21'",39 "tmp.zig:9:21: error: expected type '*S', found '*const struct:9:21'",
40 });40 });
4141
42 cases.add("@Type() union payload is undefined",42 cases.add("@Type() union payload is undefined",
...@@ -8416,6 +8416,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -8416,6 +8416,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
8416 \\ var sequence = "repeat".*** 10;8416 \\ var sequence = "repeat".*** 10;
8417 \\}8417 \\}
8418 , &[_][]const u8{8418 , &[_][]const u8{
8419 "tmp.zig:2:30: error: `.*` can't be followed by `*`. Are you missing a space?",8419 "tmp.zig:2:30: error: `.*` cannot be followed by `*`. Are you missing a space?",
8420 });8420 });
8421}8421}