Skip to content

improve compile error when using comptime concatenation and operand has runtime known length #11773

@nektro

Description

@nektro

Zig Version

0.10.0-dev.2444+83beed09e

Steps to Reproduce

const std = @import("std");

test {
    const a = foo() ++ "bb";
    try std.testing.expect(a.len == 5);
}

fn foo() []const u8 {
    return "aaa";
}

Expected Behavior

All 1 tests passed.

Actual Behavior

test.zig:4:18: error: unable to resolve comptime value
    const a = foo() ++ "bb";
                 ^

only affects stage2

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.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