Commit Graph

1211 Commits (14308db923d361d857bd768ca7d6cb1f512081a1)

Author SHA1 Message Date
Jimmi Holst Christensen 8139c5a516
New Zig formal grammar (#1685)
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00
Andrew Kelley ef5d7ce463
array type syntax implies comptime 2018-11-09 19:26:54 -05:00
Andrew Kelley 63f636e7b7
limit integer types to maximum bit width of 65535
closes #1541
2018-11-06 11:09:14 -05:00
Andrew Kelley 2b395d4ede
remove @minValue,@maxValue; add std.math.minInt,maxInt
closes #1466
closes #1476
2018-10-26 15:01:51 -04:00
Andrew Kelley d5648d2640
remove implicit cast from T to *const T
closes #1465
2018-10-15 18:23:47 -04:00
Jimmi Holst Christensen 378d3e4403
Solve the return type ambiguity (#1628)
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00
Andrew Kelley b7dda772a8
disable C ABI tests on macos due to LLD deficiency
See #1535

we'll have a better macos linker someday
2018-10-06 00:06:36 -04:00
Jimmi Holst Christensen bc3e99c5e5
Fixed StackTrace not being resolved when panic is invalid (#1615) 2018-10-01 20:30:34 +02:00
Andrew Kelley 9d4eaf1e07
update std lib API for I/O
std.io.FileInStream -> std.os.File.InStream
std.io.FileInStream.init(file) -> file.inStream()
std.io.FileOutStream -> std.os.File.OutStream
std.io.FileOutStream.init(file) -> file.outStream()

remove a lot of error code possibilities from os functions

std.event.net.socketRead -> std.event.net.read
std.event.net.socketWrite -> std.event.net.write
add std.event.net.readv
add std.event.net.writev
add std.event.net.readvPosix
add std.event.net.writevPosix
add std.event.net.OutStream
add std.event.net.InStream

add std.event.io.InStream
add std.event.io.OutStream
2018-09-30 17:28:35 -04:00
Andrew Kelley 1c26c2f4d5
fix crash when compile error evaluating return...
...type of inferred error set. closes #1591
2018-09-26 16:59:08 -04:00
Andrew Kelley 589201b104
fix variables which are pointers to packed struct fields
closes #1121
2018-09-26 14:54:53 -04:00
Andrew Kelley dcfd15a7f0
the last number in a packed ptr is host int bytes
See #1121
2018-09-26 14:54:52 -04:00
Andrew Kelley 9485043b3c
fix implicit casting to *c_void
closes #1588

also some small std lib changes regarding posix sockets
and one doc typo fix
2018-09-26 11:06:09 -04:00
Andrew Kelley 2e562a5f36
fix crash on runtime index into slice of comptime type
closes #1435
2018-09-25 12:03:39 -04:00
Andrew Kelley eafb8e8572
fix self reference through fn ptr field crash
closes #1208
2018-09-25 10:45:11 -04:00
Andrew Kelley 4241cd666d
fix more bigint code paths and add tests 2018-09-24 16:31:22 -04:00
Andrew Kelley 877036e7ef fix translate-c test expecting incorrect C ABI on windows 2018-09-24 15:14:20 -04:00
Andrew Kelley 32c91ad892
fix comptime bitwise operations with negative values
closes #1387
closes #1529
2018-09-24 14:38:51 -04:00
Andrew Kelley 004c383292
fix translate-c incorrectly translating negative enum init values
closes #1360
2018-09-24 12:19:16 -04:00
Andrew Kelley 8a7737eef4
fix godbolt cli test on non-linux-x86_64 hosts 2018-09-24 12:01:51 -04:00
Andrew Kelley 6d048aa3bf
add panic function to godbolt CLI API test 2018-09-24 11:14:39 -04:00
Andrew Kelley a155f2973b
add test to cover the CLI API that godbolt is using
closes #1399
2018-09-24 11:12:21 -04:00
Andrew Kelley c84548e71d
fix @compileLog having unintended side effects
closes #1459
2018-09-22 10:46:22 -04:00
Andrew Kelley 5c15c5fc48
add compile error for slice of undefined slice
closes #1293
2018-09-22 10:04:47 -04:00
Andrew Kelley 2e27407161
stage1: unify 2 implementations of pointer deref
I found out there were accidentally two code paths
in zig ir for pointer dereference. So this should
fix a few bugs.

closes #1486
2018-09-21 18:47:12 -04:00
Andrew Kelley 9e5cd43e6d
fix comptime string concatenation ignoring slice bounds
closes #1362
2018-09-21 15:45:13 -04:00
Andrew Kelley 7c5e3e1f8e
fixups 2018-09-21 14:15:58 -04:00
Andrew Kelley 5a21d3dce0
Merge branch 'BitByteOffsetOfs' of https://github.com/raulgrell/zig into raulgrell-BitByteOffsetOfs 2018-09-21 13:10:21 -04:00
Andrew Kelley 44f2ee101f
fix comptime slice of pointer to array
closes #1565
2018-09-21 10:31:11 -04:00
Andrew Kelley 9c8dfadbb1
add compile error for casting const array to mutable slice
See #1565
2018-09-20 12:24:51 -04:00
Andrew Kelley f8fe517d12
better string literal caching implementation
We were caching the ConstExprValue of string literals,
which works if you can never modify ConstExprValues.
This premise is broken with `comptime var ...`.

So I implemented an optimization in ConstExprValue
arrays, where it stores a `Buf *` directly rather
than an array of ConstExprValues for the elements,
and then similar to array of undefined, it is
expanded into the canonical form when necessary.
However many operations can happen directly on the
`Buf *`, which is faster.

Furthermore, before a ConstExprValue array is expanded
into canonical form, it removes itself from the string
literal cache. This fixes the issue, because before an
array element is modified it would have to be expanded.

closes #1076
2018-09-20 11:04:31 -04:00
Andrew Kelley 345f8db1c4
fix optional pointer to empty struct incorrectly being non-null
closes #1178
2018-09-18 17:51:50 -04:00
Andrew Kelley c1af360532
add compile error for slice.*.len
closes #1372
2018-09-18 16:32:40 -04:00
Andrew Kelley 8c77c5705f
implementation for bitcasting extern enum type to c_int
closes #1036
2018-09-18 15:00:14 -04:00
Andrew Kelley 5fd3af9dc6
fix implicit cast of packed struct field to const ptr
closes #966
2018-09-18 14:34:30 -04:00
Andrew Kelley d353d5aef8
fix @bytesToSlice on a packed struct
closes #1551
2018-09-18 09:49:57 -04:00
Josh Wolfe 13645585fe link to #1544 2018-09-17 21:25:37 -04:00
Josh Wolfe d7492b2c22 somewhat realistic usecase test for shifting strange integer sizes 2018-09-17 20:49:23 -04:00
Andrew Kelley bfcfaaf5bd
fix codegen for @intCast to u0 2018-09-17 20:33:42 -04:00
Andrew Kelley b16229da1d
add compile error for @ptrCast 0 bit type to non-0 bit type 2018-09-17 19:41:11 -04:00
Andrew Kelley 78a9a465a3
add compile error for non-optional types compared against null
closes #1539
2018-09-17 18:58:50 -04:00
Andrew Kelley 6c71e9a54d
fix crash when bit shifting a u1 2018-09-17 18:44:45 -04:00
Andrew Kelley cf9200b815
dereferencing a *u0 is comptime-known to be 0 2018-09-17 18:13:38 -04:00
Andrew Kelley 4c6f1e614a
remove `zig build --init`. add `zig init-lib` and `zig init-exe`
init-lib creates a working static library with tests, and
init-exe creates a working hello world with a `run` target.

both now have test coverage with the new "cli tests" file.

closes #1035
2018-09-17 17:11:18 -04:00
Andrew Kelley 9c9eefc841
allow extern structs to have stdcallcc function pointers
closes #1536
2018-09-17 11:22:30 -04:00
Andrew Kelley dd5b2d1b04
fix crash when pointer casting a runtime extern function 2018-09-16 11:23:38 -04:00
Andrew Kelley 3f776af3fa
fix alignment of structs
closes #1248
closes #1052
closes #1154
2018-09-14 19:08:59 -04:00
Wink Saville 82af31ce36 Fix additional regressions calling FileOutStream/FileInStream init()
This is caused by change 686663239a and not
fixed in 832caefc2a.
2018-09-14 12:07:21 -04:00
Andrew Kelley 3d38feded9
fix tagged union with all void payloads but meaningful tag
closes #1322
2018-09-14 00:38:22 -04:00
Andrew Kelley 1e03cf1739
fix assertion failure on compile-time `@intToPtr` of function 2018-09-13 19:12:25 -04:00