Vexu
03c1431f9c
disallow resume and suspend in noasync scopes
2020-03-09 15:51:51 +02:00
Vexu
3618256c97
implement noasync scopes
2020-03-09 12:33:24 +02:00
LemonBoy
e2fd289a33
ir: Create usize result_loc for array subscript expr
...
Allow the subscript expression to infer the resulting type.
Closes #4169
2020-03-08 18:52:44 -04:00
daurnimator
c8050a931c
Strip trailing whitespace from src/ir.cpp
2020-03-08 19:18:25 +11:00
daurnimator
b85bb152bf
Fix grammar in error message
2020-03-08 19:18:06 +11:00
Andrew Kelley
fa46bcb368
stage1: make get_optional_type more robust
...
Now it will emit a compile error rather than crashing when the child
type has not been resolved properly.
Introduces `get_optional_type2` which should be used generally inside
ir.cpp.
Fix some std lib compile errors noticed by the provided test case.
Thanks @LemonBoy for the test case. Closes #4377 .
Fixes #4374 .
2020-03-06 18:30:30 -05:00
Andrew Kelley
3dc8cb12e8
ir: remove pointless and misleading code in @embedFile
2020-03-06 15:55:18 -05:00
Andrew Kelley
01c722c21c
Revert "Allow constant struct val to reallocate its fields when resolving an inferred struct field with a comptime value."
...
This reverts commit debcc79d56a40f77b92e243b4e344fc9385bd405.
This caused a regression when building self-hosted
2020-03-05 17:19:01 -05:00
Alexandros Naskos
debcc79d56
Allow constant struct val to reallocate its fields when resolving an inferred struct field with a comptime value.
2020-03-05 15:48:03 -05:00
Andrew Kelley
3e3d464884
@TypeOf avoids heap allocation for only 1 parameter
2020-03-04 17:43:23 -05:00
LemonBoy
0c310f0fbf
ir: Implement @TypeOf with multiple arguments
...
Closes #439
2020-03-04 17:21:10 -05:00
Andrew Kelley
24fc69acad
Merge pull request #4573 from alexnask/tuple_concat
...
Allow concatenation of tuples that contain a mix of runtime and comptime values
2020-03-04 17:09:43 -05:00
Andrew Kelley
f247a90541
get_codegen_ptr_type returns possible error
...
And fix most of the fallout. This also makes optional pointers not
require resolving zero bits, because the comptime value struct layout no
longer depends on whether the type has zero bits.
Thanks to @LemonBoy for the behavior test case
Closes #4357
Closes #4359
2020-03-04 17:04:59 -05:00
Alexandros Naskos
b838122cc0
Merge branch 'master' of https://github.com/ziglang/zig into tuple_concat
2020-03-02 00:55:19 +02:00
Alexandros Naskos
78e4daaa03
Removed unused variable
2020-03-02 00:54:57 +02:00
Alexandros Naskos
1b41f2d77e
C pointer slices are no longer allowzero ( #4462 )
...
* Slices from C pointers are no longer allowzero but instead insert a runtime assertion.
* Added a test, fixed code for cases with non-allowzero C pointers
* Create new type when flipping allow_zero, sometimes we get a cached value back from adjust_ptr_len.
* Added comments, changed panic message
* Added runtime safety test.
2020-02-29 01:36:42 -05:00
Alexandros Naskos
11848fcb5f
Removed unused variable
2020-02-28 03:48:30 +02:00
Alexandros Naskos
c020bc27ac
More fixes, removed debug prints
2020-02-28 02:43:33 +02:00
Alexandros Naskos
95a1d2feb4
Fixed tuple concatenation with runtime and comptime values.
2020-02-28 02:19:17 +02:00
Andrew Kelley
c39d7a6326
fix exported variable not respecting linkage
2020-02-27 11:51:43 -05:00
LemonBoy
2696c8b42d
ir: Robust checking for init expr type
...
Closes #3979
2020-02-27 10:40:22 -05:00
Vexu
d505ea6caf
fix @tagName on extern and non-exhaustive enums
2020-02-26 11:19:39 -05:00
LemonBoy
e9bac8be6b
ir: Fix array to slice conversion for zero-sized arrays
...
Closes #3848
2020-02-25 17:40:01 -05:00
LemonBoy
55ea855e2c
ir: Various fixes for comptime ptr handling
...
* Correctly fold ptrToInt on optional types
* Generate null as ConstPtrSpecialNull in intToPtr
* Correctly stop ptrToInt on ?*T where T is zero-sized
Closes #4535
2020-02-25 17:38:56 -05:00
Michael Dusan
416a547cdb
Merge pull request #4515 from mikdusan/stage1-gen-constants
...
stage1: free more heap after analysis
2020-02-25 10:57:47 -05:00
Vexu
d56115ef41
remove @IntType and @ArgType (mostly) from the compiler
2020-02-25 01:27:34 +02:00
Vexu
3458fb891d
remove @typeId, @memberCount, @memberName and @memberType from the compiler
2020-02-24 23:21:11 +02:00
xackus
9c35f680f7
nuke @bytesToSlice, @sliceToBytes in stage1
2020-02-23 19:03:55 +01:00
Michael Dusan
770631cc79
stage1: free more heap after analysis
...
- immediately free dangling IrInstGenConst after analysis
- fixup mem::List params `&Allocator` → `*Allocator`
2020-02-20 21:05:37 -05:00
LemonBoy
a385547786
ir: Compile error on result_loc type mismatch w/ slicing
...
Closes #4508
2020-02-20 13:14:19 +01:00
Andrew Kelley
ccca4b5a5e
Merge pull request #4474 from LemonBoy/saukerkraut
...
Patches
2020-02-18 18:15:11 -05:00
Timon Kruiper
7560fc716d
Makes the declaration slice resolve lazely when using @typeInfo
...
This way all the declarations in a container won't be resolved untill
the user actually uses the decls slice in the builtin TypeInfo union.
2020-02-18 15:26:37 -05:00
LemonBoy
6b74fd2e12
ir: Avoid invalidating the decl_table iterator
...
Collect the declarations to resolve first and run resolve_top_level_decl
on them later.
Closes #4310
2020-02-16 21:14:30 +01:00
LemonBoy
096f79260b
ir: Prevent crash when indexing undefined ptr to array
...
Closes #4471
2020-02-16 19:53:53 +01:00
Andrew Kelley
7f7d1fbe5a
Implement noasync awaits
...
Note that there is not yet runtime safety for this.
See #3157
2020-02-16 01:44:52 -05:00
LemonBoy
3038290a46
ir: Make all the payload captures do a copy
...
The payload doesn't alias anymore the same memory it comes from and is
instead a fresh copy of the original object.
2020-02-14 15:30:20 +01:00
LemonBoy
a090a5e3bc
ir: Don't crash when converting undefined ptrs
2020-02-13 16:18:24 -05:00
LemonBoy
c5260f7f86
ir: Allow implicit conversion between vector types
...
Only valid when the number of elements match and the types are
compatible.
Fixes #4334
2020-02-13 12:13:56 +01:00
LemonBoy
6c05f0949a
ir: Fix erroneous error message for ptr casts
...
Don't blindly throw an error if two integer types are checked for
compatibility.
Bug reported in #4430
2020-02-11 17:03:11 +01:00
Michael Dusan
e624c86289
Merge pull request #4389 from mikdusan/stage1-mem
...
stage1: memory/report overhaul
2020-02-10 23:08:33 -05:00
Michael Dusan
edb210905d
stage1: memory/report overhaul
...
- split util_base.hpp from util.hpp
- new namespaces: `mem` and `heap`
- new `mem::Allocator` interface
- new `heap::CAllocator` impl with global `heap::c_allocator`
- new `heap::ArenaAllocator` impl
- new `mem::TypeInfo` extracts names without RTTI
- name extraction is enabled w/ ZIG_ENABLE_MEM_PROFILE=1
- new `mem::List` takes explicit `Allocator&` parameter
- new `mem::HashMap` takes explicit `Allocator&` parameter
- add Codegen.pass1_arena and use for all `ZigValue` allocs
- deinit Codegen.pass1_arena early in `zig_llvm_emit_output()`
2020-02-10 21:08:08 -05:00
Timon Kruiper
2618366055
Add cast between [*c]T and ?[*:0]T on fn parameter
...
Fixes #4176
2020-02-10 19:43:58 -05:00
Andrew Kelley
3170ead9eb
compile error instead of abort for unimplemented @typeInfo
...
of `@Frame(func)`. Closes #3995
2020-02-10 19:14:54 -05:00
Andrew Kelley
70a4794c57
fix compiler assertion when duplicating fields...
...
...in nested anonymous struct literals
closes #4391
2020-02-10 10:57:40 -05:00
Andrew Kelley
014f66e6de
Merge pull request #4404 from ziglang/async-std
...
a big step towards std lib integration with async I/O
2020-02-10 00:22:59 -05:00
Andrew Kelley
5ea79bfc4a
fix not checking type of return pointer
...
Thanks to Vexu for the test cases.
Closes #3422
Closes #3646
Closes #3224
Closes #3327
Closes #3269
2020-02-09 22:34:34 -05:00
Andrew Kelley
04ee3b01a1
fix defer interfering with return value spill
2020-02-09 17:19:28 -05:00
Andrew Kelley
24d197b037
solve previous commit a better way
2020-02-08 15:28:12 -05:00
Andrew Kelley
d80db3546c
Revert "properly spill optional payload capture value"
...
This reverts commit 80ba21b83cd13849c1d1d9cdebfa070b03f334d3.
2020-02-08 15:07:12 -05:00
Andrew Kelley
80ba21b83c
properly spill optional payload capture value
2020-02-08 14:59:33 -05:00