Commit 97c41e7152
Changed files (2)
src-self-hosted
test
stage2
src-self-hosted/Module.zig
@@ -1696,13 +1696,7 @@ fn analyzeRootSrcFile(self: *Module, root_scope: *Scope.File) !void {
if (src_decl.cast(ast.Node.FnProto)) |fn_proto| {
// We will create a Decl for it regardless of analysis status.
const name_tok = fn_proto.name_token orelse {
- const err_msg = try ErrorMsg.create(self.allocator, tree.token_locs[fn_proto.firstToken()].end, "missing function name", .{});
- // TODO: cache a single invalid decl in the Module?
- const new_decl = try self.createNewDecl(&root_scope.base, "", decl_i, [1]u8{0} ** 16, [1]u8{0} ** 16);
- root_scope.decls.appendAssumeCapacity(new_decl);
- errdefer err_msg.destroy(self.allocator);
- try self.failed_decls.putNoClobber(new_decl, err_msg);
- continue;
+ @panic("TODO missing function name");
};
const name_loc = tree.token_locs[name_tok];
test/stage2/compile_errors.zig
@@ -62,26 +62,31 @@ pub fn addCases(ctx: *TestContext) !void {
\\@1 = export(@0, "start")
);
- ctx.incrementalFailure("function redefinition", linux_x64,
+ ctx.compileError("function redefinition", linux_x64,
\\fn entry() void {}
\\fn entry() void {}
- , &[_][]const u8{":2:4: error: redefinition of 'entry'"},
- \\fn entry() void {}
- );
-
- // TODO: need to make sure this works with other variants of export.
- ctx.incrementalFailure("exported symbol collision", linux_x64,
- \\export fn entry() void {}
- \\export fn entry() void {}
- , &[_][]const u8{":2:11: error: redefinition of 'entry'"},
- \\export fn entry() void {}
- );
-
- ctx.incrementalFailure("missing function name", linux_x64,
- \\fn() void {}
- , &[_][]const u8{":1:3: error: missing function name"},
- \\fn a() void {}
- );
+ , &[_][]const u8{":2:4: error: redefinition of 'entry'"});
+
+ //ctx.incrementalFailure("function redefinition", linux_x64,
+ // \\fn entry() void {}
+ // \\fn entry() void {}
+ //, &[_][]const u8{":2:4: error: redefinition of 'entry'"},
+ // \\fn entry() void {}
+ //);
+
+ //// TODO: need to make sure this works with other variants of export.
+ //ctx.incrementalFailure("exported symbol collision", linux_x64,
+ // \\export fn entry() void {}
+ // \\export fn entry() void {}
+ //, &[_][]const u8{":2:11: error: redefinition of 'entry'"},
+ // \\export fn entry() void {}
+ //);
+
+ // ctx.incrementalFailure("missing function name", linux_x64,
+ // \\fn() void {}
+ // , &[_][]const u8{":1:3: error: missing function name"},
+ // \\fn a() void {}
+ // );
// TODO: re-enable these tests.
// https://github.com/ziglang/zig/issues/1364