Skip to content

errdefer capture is an error union instead of error set when the function returns an @errorCasted error #20371

@xdBronch

Description

@xdBronch

Zig Version

0.14.0-dev.107+e03026507

Steps to Reproduce and Observed Behavior

pub fn main() error{a}!void {
    errdefer |err| @compileLog(@TypeOf(err));
    return @errorCast(@as(anyerror!void, error.a));
}

@as(type, error{a}!void)

Expected Behavior

the captured err should be an error{a}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions