Andrew Kelley
8dd24796c4
disallow implicit casts that break rules for optionals
...
closes #1102
2018-06-13 11:04:09 -04:00
Andrew Kelley
86adc1ef39
add docs and missing test case for merging error sets
...
See #367
2018-06-12 19:38:59 -04:00
Andrew Kelley
259413251d
fix ability to call mutating methods on zero size structs
...
closes #838
2018-06-12 15:06:02 -04:00
Andrew Kelley
03c16c6c54
implement @tagName as a switch instead of table lookup
...
closes #976
closes #1080
2018-06-11 14:58:42 -04:00
Andrew Kelley
77678b2cbc
breaking syntax change: orelse keyword instead of ?? ( #1096 )
...
use the `zig-fmt-optional-default` branch to have zig fmt
automatically do the changes.
closes #1023
2018-06-10 01:13:51 -04:00
Andrew Kelley
ec1b6f6673
breaking syntax change: ??x to x.? ( #1095 )
...
See #1023
This also renames Nullable/Maybe to Optional
2018-06-09 23:42:14 -04:00
Andrew Kelley
6edd81109d
nullable pointers follow const-casting rules
...
any *T -> ?*T cast is allowed implicitly, even
when it occurs deep inside the type, and the cast
is a no-op at runtime.
in order to add this I had to make the comptime value
representation of nullable pointers the same as the
comptime value representation of normal pointers,
so that we don't have to do any recursive transformation
of values when doing this kind of cast.
2018-06-09 00:26:26 -04:00
Jimmi HC
bf3d1c1aab
Allow access of array.len through a pointer
2018-06-08 09:21:31 +02:00
Andrew Kelley
f0b6dac1f2
add implicit casts from `*[N]T`
...
* to `[]T`
* to `[*]T`
See #770
2018-06-07 22:41:58 -04:00
Andrew Kelley
b65203f573
remove @canImplicitCast builtin
...
nobody will miss it
2018-06-07 19:50:25 -04:00
Andrew Kelley
31aefa6a21
fix structs that contain types which require comptime
...
Now, if a struct has any fields which require comptime,
such as `type`, then the struct is marked as requiring
comptime as well. Same goes for unions.
This means that a function will implicitly be called
at comptime if the return type is a struct which contains
a field of type `type`.
closes #586
2018-06-07 18:07:30 -04:00
Andrew Kelley
d3693dca73
Pointer Reform: update @typeInfo
...
* add assertion for trying to do @typeInfo on global error set
* remove TypeInfo.Slice
* add TypeInfo.Pointer.Size with possible values
- One
- Many
- Slice
See #770
2018-06-06 00:39:39 -04:00
Andrew Kelley
76c8efd56c
add test for not allowing implicit cast from T to [*]const T
...
See #770
2018-06-05 23:54:14 -04:00
Andrew Kelley
bd13e757e7
disable deref syntax for unknown length pointers
...
See #770
2018-06-05 23:26:43 -04:00
Andrew Kelley
0ccc186869
disable field access for unknown length pointers
...
See #770
2018-06-05 23:26:43 -04:00
Andrew Kelley
652f4bdf62
disallow unknown-length pointer to opaque
...
This also means that translate-c has to detect when a pointer to
opaque is happening, and use `*` instead of `[*]`.
See #1059
2018-06-05 18:03:21 -04:00
Andrew Kelley
7a09482536
fix crash when evaluating return type has compile error
...
closes #1058
2018-06-05 10:48:53 -04:00
Jimmi HC
a8146ade2a
Renamed UndefinedLiteral to Undefined
2018-06-05 11:54:11 +02:00
Jimmi HC
236c680f6b
Removed NullLiteral to Null
2018-06-05 11:30:01 +02:00
Jimmi HC
02cb220faf
Renamed "(int/float literal)" to "comptime_int/float"
2018-06-05 11:14:43 +02:00
Andrew Kelley
e53b683bd3
Pointer Reform: proper slicing and indexing ( #1053 )
...
* enable slicing for single-item ptr to arrays
* disable slicing for other single-item pointers
* enable indexing for single-item ptr to arrays
* disable indexing for other single-item pointers
see #770
closes #386
2018-06-04 22:11:14 -04:00
Andrew Kelley
d21a1922eb
support `zig fmt: off` and `zig fmt: on` between top level decls
...
closes #1030
closes #1033
2018-06-04 12:15:02 -04:00
Andrew Kelley
96164ce613
disallow single-item pointer indexing
...
add pointer arithmetic for unknown length pointer
2018-06-04 01:39:57 -04:00
Andrew Kelley
b85b68a7fd
better compile error for error sets behind nullable
2018-06-02 15:20:51 -04:00
Andrew Kelley
5f38a01ede
run zig fmt
2018-06-01 01:22:35 -04:00
Andrew Kelley
2a7c8c5b10
add test case for pointer to type and slice of type
...
closes #588
2018-06-01 00:18:10 -04:00
Andrew Kelley
019217d7a2
fix regressions
2018-06-01 00:17:31 -04:00
Andrew Kelley
fcbb7426fa
use * for pointer type instead of &
...
See #770
To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.
This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00
Andrew Kelley
ea58f4a5a9
run zig fmt on the codebase
2018-05-30 16:09:11 -04:00
Jimmi HC
2b3af4ef6b
fixed #1009
...
ir_make_type_info_defs already calls resolve_top_level_decl on all Tld
when building the def array. This means, that there is no reason that
analyze_fn_body is nessesary, as the fn type should have already been
resolved completly. The only thing analyze_fn_body does here, is cause
problems with generic functions.
2018-05-30 10:30:09 +02:00
Andrew Kelley
0c16cd2d0e
run zig fmt on the codebase
...
See #1003
2018-05-29 04:23:38 -04:00
Andrew Kelley
c029f4bfc4
trailing comma after var args is not supported
2018-05-25 20:41:14 -04:00
Andrew Kelley
08f95d0c2f
enum fields with a type are not supported
...
the c++ codebase lets it slide
the self hosted parser correctly reports a parse error
2018-05-25 01:10:54 -04:00
Andrew Kelley
ca49b6f6b4
struct fields with no explicit type are not supported
...
the c++ codebase lets it slide
the self hosted parser correctly reports a parse error
2018-05-25 00:39:18 -04:00
Andrew Kelley
43085417be
update github.com/zig-lang to github.com/ziglang
2018-05-24 21:27:44 -04:00
Andrew Kelley
c38b165db4
all tests passing with postfix deref syntax
2018-05-17 23:21:44 -04:00
Andrew Kelley
5cfabdd493
Merge remote-tracking branch 'origin/master' into pointer-reform
2018-05-16 00:02:26 -04:00
Andrew Kelley
74b10c08d1
fix @typeInfo not setting a field to comptime
2018-05-15 14:11:41 -04:00
Andrew Kelley
86a352c45b
Merge branch 'master' into pointer-reform
2018-05-13 13:38:03 -04:00
Andrew Kelley
a6ae45145f
add @newStackCall builtin function
...
See #1006
2018-05-12 17:35:15 -04:00
Andrew Kelley
277b9cf878
fix comptime code modification of global const
...
closes #1008
2018-05-11 22:41:44 -04:00
Marc Tiehuis
efa39c5343
Fix bigint shift-right partial shift
2018-05-10 22:26:26 +12:00
Andrew Kelley
6928badd85
Merge branch 'master' into pointer-reform
2018-05-09 23:43:07 -04:00
Andrew Kelley
bf21747a42
translate-c: fix typedef duplicate definition of variable
...
closes #998
2018-05-09 20:23:36 -04:00
Jimmi HC
9b29c872ce
Added Slice as it's own type info in userland
2018-05-09 09:34:04 +02:00
Andrew Kelley
77a1a216d2
tagged union field access prioritizes members over enum tags
...
closes #959
2018-05-07 16:43:20 -04:00
Marc Tiehuis
d7b029995c
Fix bigint multi-limb shift and masks
2018-05-05 22:40:29 +12:00
Andrew Kelley
b9e320dd52
Merge pull request #951 from alexnask/reflect_reify
...
Metaprogramming - @typeInfo [DONE]
2018-05-03 23:02:33 -04:00
Jimmi Holst Christensen
aa2586de18
Fixed extern enums having the wrong size ( #970 )
...
Fixed extern enums having the wrong size
See #977
2018-05-03 22:27:04 -04:00
Andrew Kelley
adbb691f46
fix behavior tests for ReleaseSmall
2018-05-02 22:48:04 -04:00