fix dot init parsing

This commit is contained in:
Vexu 2019-12-12 18:26:12 +02:00 committed by Andrew Kelley
parent d08dc21116
commit c759a77aa0
2 changed files with 17 additions and 1 deletions

View File

@ -1923,7 +1923,11 @@ static AstNode *ast_parse_anon_lit(ParseContext *pc) {
}
// anon container literal
return ast_parse_init_list(pc);
AstNode *res = ast_parse_init_list(pc);
if (res != nullptr)
return res;
put_back_token(pc);
return nullptr;
}
// AsmOutput <- COLON AsmOutputList AsmInput?

View File

@ -2,6 +2,18 @@ const tests = @import("tests.zig");
const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add("invalid float literal",
\\const std = @import("std");
\\
\\pub fn main() void {
\\ var bad_float :f32 = 0.0;
\\ bad_float = bad_float + .20;
\\ std.debug.assert(bad_float < 1.0);
\\})
, &[_][]const u8{
"tmp.zig:5:29: error: invalid token: '.'",
});
cases.add("var args without c calling conv",
\\fn foo(args: ...) void {}
\\comptime {