Skip to content

Compilation error with ordinary comment before test code. #12233

Description

@mass10

Zig Version

0.10.0-dev.2859+0101a5f75

Steps to Reproduce

const std = @import("std");

/// safe
pub fn main() anyerror!void {
    // safe
    std.log.info("Ok.", .{});
}

/// THIS COMMENT CAUSES COMPILATION ERROR! > error: invalid token: 'test'
test "basic test" {
    try std.testing.expectEqual(10, 3 + 7);
}

Expected Behavior

No compilation errors.

Actual Behavior

Compilation error occured.

error: invalid token: 'test'

So, // causes no errors.

// NO ERRORS.
test "basic test" {
    try std.testing.expectEqual(10, 3 + 7);
}

Activity

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

Metadata

Metadata

Assignees

Labels

error messageThis issue points out an error message that is unhelpful and should be improved.frontendTokenization, parsing, AstGen, Sema, and Liveness.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions