Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

??T on bare struct causes compile error #11

Open
haze opened this issue May 10, 2023 · 0 comments
Open

??T on bare struct causes compile error #11

haze opened this issue May 10, 2023 · 0 comments

Comments

@haze
Copy link

haze commented May 10, 2023

pub const Document = struct {
    revision: ??[]const u8,
    description: ??[]const u8,
};

parsing the preceding results in this compile error:

/Users/haze/.cache/zig/p/1220beaae8d152baa941a10b7ef3d3a59d093b257047035e2373c3c2f876ad29ccc8/tres.zig:549:69: error: unable to evaluate comptime expression
                    } else if (comptime dualable(field.type) and nm == .dual) {
                                                                 ~~~^~~~~~~~
/Users/haze/.cache/zig/p/1220beaae8d152baa941a10b7ef3d3a59d093b257047035e2373c3c2f876ad29ccc8/tres.zig:549:66: note: operation is runtime due to this operand
                    } else if (comptime dualable(field.type) and nm == .dual) {

(parsed like so)

    var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
    defer arena.deinit();

    var parser = std.json.Parser.init(arena.allocator(), false);
    const tree = try parser.parse(data);

    const document = try tres.parse(Document, tree.root, arena.allocator());
    std.log.warn("{}", .{document});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant