-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Zig Version
0.10.0-dev.1246+5fbae9cd6
Steps to Reproduce
cc @ifreund and @mitchellh , who provided these test cases
test {
const T = @TypeOf(.{ @as(i32, 0), @as(u8, 123) });
var a: T = .{-1234, 0};
try testing.expectEqual(@as(i32, 0), a[0]);
try testing.expectEqual(@as(u8, 123), a[1]);
}
test {
const T = struct {
comptime x: i32 = 0,
comptime y: u8 = 123,
};
var a: T = .{.x = -1234, .y = 0};
try testing.expectEqual(@as(i32, 0), a.x);
try testing.expectEqual(@as(u8, 123), a.y);
}Expected Behavior
Test should fail - the provided field does not match the value of the comptime field.
Equality should be checked for the init value of comptime fields, in both structs and arrays.
Actual Behavior
The test passes on stage1.
It fails on stage2 due to #11159, but once that bug is fixed it will incorrectly pass.
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.