diff options
| author | Vexu <git@vexu.eu> | 2020-05-12 15:20:03 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-12 15:20:03 +0300 |
| commit | 29b3be4f2f30f756ef0317f79c349f5565b04d19 (patch) | |
| tree | 1cf04ccfb8ce0b0fb2e2b68686abe452c0077fda /test | |
| parent | 7456389ef3c29e37d5d9bc7f8365db3217b3f60e (diff) | |
| parent | 0847b47bf83c699d27c903e51b20f863d47c5790 (diff) | |
| download | zig-29b3be4f2f30f756ef0317f79c349f5565b04d19.tar.gz zig-29b3be4f2f30f756ef0317f79c349f5565b04d19.zip | |
Merge pull request #5319 from Vexu/float-fix
Fix intToFloat on comptime_floats
Diffstat (limited to 'test')
| -rw-r--r-- | test/stage1/behavior/cast.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/stage1/behavior/cast.zig b/test/stage1/behavior/cast.zig index 8717c8e619..77cdacc307 100644 --- a/test/stage1/behavior/cast.zig +++ b/test/stage1/behavior/cast.zig @@ -827,3 +827,12 @@ test "peer type resolve array pointer and unknown pointer" { comptime expect(@TypeOf(&const_array, const_ptr) == [*]const u8); comptime expect(@TypeOf(const_ptr, &const_array) == [*]const u8); } + +test "comptime float casts" { + const a = @intToFloat(comptime_float, 1); + expect(a == 1); + expect(@TypeOf(a) == comptime_float); + const b = @floatToInt(comptime_int, 2); + expect(b == 2); + expect(@TypeOf(b) == comptime_int); +} |
