1454 Commits

Author SHA1 Message Date
LemonBoy
fe4ef7b461
Fix comptime float-int comparisons
Closes #4259
2020-01-29 16:37:55 -05:00
LemonBoy
59bc1d2721 Fix edge case in switch with single else
ir_gen_switch_expr doesn't set the switch_br field at all if there are
zero cases, detect this situation and handle it gracefully.

Closes #4322
2020-01-29 16:05:14 -05:00
Benjamin Feng
a4ac7980b4 Add a spill to while error union 2020-01-29 10:01:51 -06:00
Benjamin Feng
2f239e3dbd Add a spill to while optional 2020-01-28 23:36:43 -06:00
Andrew Kelley
504ce86ac9
fix more compile error test regressions 2020-01-28 14:17:25 -05:00
Andrew Kelley
793d81c4e8
fix result locations not handling undefined correctly 2020-01-28 13:33:51 -05:00
Andrew Kelley
86da9346e4
fix error message column/line number regressions 2020-01-28 13:25:49 -05:00
Andrew Kelley
e0000c47bd
fix regression of storing optional with 0-bit payload 2020-01-28 12:32:39 -05:00
Andrew Kelley
287d3c37e1
fix 0-bit child type coerced to optional return ptr result location
by un-special-casing 0 bit types in result locations
2020-01-28 11:39:36 -05:00
Andrew Kelley
8710fdbf39
fix line, column numbers of compile errors 2020-01-27 22:05:27 -05:00
Andrew Kelley
ae20574d5e
add missing spill for for loops with pointer elems 2020-01-27 21:30:11 -05:00
Andrew Kelley
9d59cdb8c1
fix auto created variables not having correct alignment 2020-01-27 19:42:32 -05:00
Andrew Kelley
37ab960492
fix not handling undefined u0 correctly 2020-01-27 18:59:46 -05:00
Andrew Kelley
b38b967844
fix triple level result location with bitcast sandwich
...passed as tuple element
2020-01-27 18:26:39 -05:00
Andrew Kelley
b96872ef2f
@bitCast result location: fix passing invalid alignment
when the value has 0 bits
2020-01-27 17:45:29 -05:00
Andrew Kelley
c0fee9dfc7
fix nested bitcast passed as tuple element 2020-01-27 17:30:39 -05:00
Andrew Kelley
e2778c03e0
Merge branch 'master' into ir-clean-up-vars 2020-01-27 13:32:39 -05:00
Andrew Kelley
f41e50dc08
Merge branch 'fx-4274' of https://github.com/LemonBoy/zig into LemonBoy-fix-4274 2020-01-27 09:52:31 -05:00
Andrew Kelley
d9fb6c2054
fix compilation error 2020-01-26 00:55:04 -05:00
Andrew Kelley
9dffc369f1
Merge remote-tracking branch 'origin/master' into layneson-cpus_and_features 2020-01-25 23:25:29 -05:00
Andrew Kelley
32f0039b43
fix memory profiling 2020-01-25 22:02:10 -05:00
Andrew Kelley
6aac423964
split IrInstruction into IrInst, IrInstSrc, IrInstGen
This makes it so that less memory is used for IR instructions, as well
as catching bugs when one expected one kind of instruction and received
the other.
2020-01-25 21:49:32 -05:00
LemonBoy
8d9b8ab930 More error checking for unresolved TLDs
Closes #4274
2020-01-23 22:40:12 +01:00
Andrew Kelley
f3dd9bbdac
improve zig targets 2020-01-20 13:40:25 -05:00
Andrew Kelley
7bb4c855ad
Merge pull request #4222 from LemonBoy/eutwouwth
Prevent crash with empty non-exhaustive enum
2020-01-18 19:25:23 -05:00
LemonBoy
b0f753e21d Fix edge case in tagName handling of unions
Closes #4226
2020-01-18 20:16:15 +01:00
LemonBoy
f456b88bae Get rid of some dead logic 2020-01-18 19:24:04 +01:00
LemonBoy
c53d94e512 Prevent crash with empty non-exhaustive enum 2020-01-18 15:13:21 +01:00
LemonBoy
5f2bac010d Allow @tagName on enum literals
Closes #4214
2020-01-18 09:55:18 +01:00
Andrew Kelley
b5ac079f88
Merge pull request #4191 from Vexu/non-exhaustive-enums
Implement non-exhaustive enums
2020-01-17 14:26:12 -05:00
Andrew Kelley
8f336b3970
revert one part of ir get_elem_ptr analysis
this reverts one part of 4c3bfeca. it solves some behavior regressions
but introduces new ones. This change was incorrect to make however,
and this commit takes the code in a better direction.
2020-01-16 21:58:52 -05:00
Andrew Kelley
6a8c9f7306
fix regression with optionals and globals 2020-01-16 21:58:52 -05:00
Andrew Kelley
8bf425957b
fix regressions double implicit casting return ptr 2020-01-16 21:58:52 -05:00
Andrew Kelley
e48157c3cb
fix regression with inferred struct fields 2020-01-16 21:58:52 -05:00
Andrew Kelley
fb8da16a60
fix regressions in get_elem_ptr related to undefined 2020-01-16 21:58:52 -05:00
Andrew Kelley
d0b055d69e
fix implicit cast regression 2020-01-16 21:58:52 -05:00
Andrew Kelley
96d64a40a6
fix regression with var ptrs not being const 2020-01-16 21:58:52 -05:00
Andrew Kelley
b6c8fead00
fix regression in global const alignment 2020-01-16 21:58:51 -05:00
Andrew Kelley
fbcee58cfc
zig ir.cpp details: remove the mem_slot mechanism
Previously, there was hacky code to deal with result locations and how
they work with regards to comptime values and runtime values. In
addition, there was a hacky "mem_slot" mechanism that managed the memory
for local variables, and acted differently depending on comptime vs
runtime situations. All that is deleted in this commit, and as a result,
result locations code has one less complication.

Importantly, this means that a comptime result location is now passed to
a function when it is evaluated at comptime.

This test causes many regressions, and some of the behavior tests are
disabled (commented out) in this commit. Future commits will re-enable
the tests before merging the branch.
2020-01-16 21:58:47 -05:00
Vexu
bac27731e3 add struct field default value to typeinfo 2020-01-16 13:22:30 -05:00
Vexu
df03fcf5f0 implement @bitSizeOf 2020-01-16 13:13:45 -05:00
Vexu
d84569895c
turn panics into compile errors, require at least 1 field in non-exhaustive enum 2020-01-16 09:04:11 +02:00
Vexu
5c2238fc4a
small fixes
* error for '_' prong on exhaustive enum
* todo panic for `@tagName`  on non-exhaustive enum
* don't require '_' field on tagged unions
2020-01-15 22:09:19 +02:00
Vexu
c57784aa15
add is_exhaustive field to typeinfo 2020-01-15 21:50:12 +02:00
Vexu
6fd0dddf18
implement non-exhaustive enums 2020-01-15 20:24:59 +02:00
LemonBoy
49771f356f Make sure @export symbol name is not empty 2020-01-14 21:23:11 +01:00
LemonBoy
84930fec27 Validate switch range endpoints 2020-01-13 21:45:16 +01:00
LemonBoy
34cdcb13c0 Fix @call being too eager to resolve the fn argument
Closes #4020
2020-01-12 23:51:18 +01:00
LemonBoy
c96131f30c Propagate errors in for loop bodies
Closes #3819
2020-01-12 12:49:12 -05:00
Andrew Kelley
5e345ff0ee
Merge pull request #3955 from LemonBoy/fix-1528
Pointer arithmetic affects the alignment factor
2020-01-09 13:53:56 -05:00