-
Notifications
You must be signed in to change notification settings - Fork 1
Handle parsing into ambiguous types in a union #18
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested
Description
As reported in https://zigforum.org/t/zig-nestedtext-release-0-1-0/383/17:
test "typed parse: jeang3nie" {
const Kind = union(enum) {
color: []const u8,
plain,
};
var p = Parser.init(testing.allocator, .{});
const r = try p.parseTyped(Kind, "> null");
defer p.parseTypedFree(r);
std.debug.print("{s}\n", .{r});
}This parses into color with the string null since this is the first field that succeeds, but parsing as a string should probably be the last resort (since this will always succeed).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested