1160 Commits

Author SHA1 Message Date
Andrew Kelley
5c55a9b4e8
fix compile error regression with struct containing itself 2020-01-28 11:52:48 -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
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
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
7a1cde7206 Fix wrong error code being returned in enum analisys
Fixes the assertion failure seen in #4233
2020-01-19 13:28:27 -05:00
LemonBoy
c53d94e512 Prevent crash with empty non-exhaustive enum 2020-01-18 15:13:21 +01:00
Andrew Kelley
396d57c498
fix failing array test by improving copy_const_val 2020-01-16 21:58:53 -05:00
Andrew Kelley
8bf425957b
fix regressions double implicit casting return ptr 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
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
6c8f01dcde
correct field count 2020-01-16 22:52:10 +02:00
Vexu
cb257b4e11
allow non-exhaustive enums with no fields 2020-01-16 09:23:26 +02: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
f3d174aa61
require size for non-exhaustive enums 2020-01-15 21:38:11 +02:00
Vexu
6fd0dddf18
implement non-exhaustive enums 2020-01-15 20:24:59 +02:00
LemonBoy
50754ba336 Fix ICE when BoundFn are passed as parameters
Closes #4022
Closes #3699
2020-01-14 13:09:23 -05:00
Andrew Kelley
4f9739189e
add an extra assert 2020-01-13 14:48:43 -05:00
LemonBoy
9cc7fb66bc Don't special-case builtin too much
Let's use the usual declaration-searching mechanism that resolves the
`usingnamespace` declarations on the go instead of directly peeking into
the symbol table.

Fixes #4134
2020-01-10 16:44:15 -05:00
LemonBoy
5ab5de89c0 New @export() handling
Use a struct as second parameter to be future proof (and also allows to
specify default values for the parameters)

Closes #2679 as it was just a matter of a few lines of code.
2020-01-09 13:43:06 -05:00
LemonBoy
27b290f312 Propagate more failures upwards
Fixes #4112
2020-01-08 17:25:00 -05:00
Andrew Kelley
be2483c576
fix test suite regressions 2020-01-06 18:20:31 -05:00
Andrew Kelley
5951b79af4
remove stdcallcc, extern, nakedcc from stage1; zig fmt rewrites 2020-01-06 15:23:05 -05:00
Andrew Kelley
0a9daeb37e
Merge branch 'cc-work' of https://github.com/LemonBoy/zig into LemonBoy-cc-work 2020-01-06 14:07:56 -05:00
LemonBoy
b91eaba38c Correct evaluation of optional type alignment
The lazy logic was too oversimplified and produced a different result
than the one computed later causing all kinds of problems.

Closes #4013
2020-01-03 17:41:55 -05:00
LemonBoy
0ccac79c8e Implement Thiscall CC 2020-01-02 18:57:08 +01:00
LemonBoy
271fc6a247 Catch more errors during the type resolution phase
Returning the uninitialized/stale error condition made the compiler turn
a blind eye to some problems.
2020-01-02 18:53:20 +01:00
LemonBoy
563d9ebfe5 Implement the callconv() annotation 2020-01-02 18:53:16 +01:00
Andrew Kelley
a05150e92d
fix comparing comptime_int against undefined literal
closes #4004
2019-12-30 19:08:57 -05:00
LemonBoy
28a8ded95a Resolve more types as needed
Closes #3994
2019-12-30 17:45:09 -05:00
Andrew Kelley
ad92227516
report compile errors instead of crashing when frame is invalid 2019-12-22 17:09:11 -05:00
LemonBoy
d8499f7abe Make sure the fields array is always non-null
Fixes #3497
2019-12-17 15:45:22 -05:00
Andrew Kelley
9468d63819
allow comparison of any numeric types 2019-12-16 11:09:10 -05:00
Vexu
0f38410ea6
improve extern enum 2019-12-15 19:28:53 -05:00
LemonBoy
f1407b4b7e Generate the fn pointers into the correct address space
Fixes #3645
2019-12-15 14:42:53 -05:00
Andrew Kelley
fff3c1fff4
un-special-case startup code in the std lib
Previously, the compiler had special logic to determine whether to
include the startup code, which was in `std/special/start.zig`. Now,
the file is moved to `std/start.zig`, and there is no special logic
in the compiler. Instead, the standard library unconditionally imports
the `start.zig` file, which then has a `comptime` block that does the
logic of determining what, if any, start symbols to export. Instead of
`start.zig` being in its own special package, it is just another normal
file that is part of the standard library.

`std.builtin.TestFn` is now part of the standard library rather than
specially generated by the compiler.
2019-12-12 18:33:44 -05:00
Robin Voetter
f0ee0688f2
Replace typeOf with TypeOf in stage0 2019-12-10 11:09:30 -05:00
Andrew Kelley
a3f6a58c77
remove var args from the language
closes #208
2019-12-09 15:27:27 -05:00
Andrew Kelley
5874cb04bd
implement tuple concatenation 2019-12-08 22:44:41 -05:00
Andrew Kelley
6504c5098e
tuple detection does not require AST node 2019-12-08 18:39:52 -05:00
LemonBoy
d5e788072d
Make array types (quasi-)lazy
Fixes #3843
2019-12-08 17:29:59 -05:00
Andrew Kelley
1cb19d1a46
fix anon struct literal field initialized with fn call 2019-12-08 17:28:34 -05:00
Andrew Kelley
fe8d65556d
add syntax for comptime struct fields 2019-12-08 12:26:20 -05:00
Andrew Kelley
119ed128c0
implement comptime struct fields 2019-12-08 12:26:20 -05:00
Andrew Kelley
343987cd05
remove @inlineCall from zig 2019-12-06 14:12:01 -05:00
Andrew Kelley
1f602fe8c5
implement @call
closes #3732
2019-12-05 17:07:15 -05:00
Vexu
a0ca30ce01
move more startup code to std lib 2019-12-03 12:50:18 -05:00
LemonBoy
fd7c7be33c Pick up WinMain with proper CC 2019-12-03 12:49:08 -05:00