mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 22:09:49 +00:00
fix dot init parsing
This commit is contained in:
parent
d08dc21116
commit
c759a77aa0
@ -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?
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user