Skip to content

Incorrect error message when using continue with a return value #14687

Description

@perillo

Zig Version

0.11.0-dev.6417+0bb178bbb

Steps to Reproduce and Observed Output

const std = @import("std");
const debug = std.debug;

pub fn main() void {
    var a: isize = blk: {
            continue :blk -10;
    };
    debug.print("a: {}\n", .{a});
}
$ zig run main.zig
main.zig:6:27: error: binary operator `-` has whitespace on one side, but not the other.
            continue :blk -10;
                          ^

Expected Output

main.zig:6:27: error: expected ';' after statement
            continue :blk -10;
                          ^~

NOTE: this is the error returned when using a positive number.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    error messageThis issue points out an error message that is unhelpful and should be improved.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions