Commit Graph

626 Commits (c42c91ee7c630d47e6adc0a940b5f10bbe04d13a)

Author SHA1 Message Date
Andrew Kelley c42c91ee7c fix segfault with array of generic functions
closes #377
2017-05-26 14:39:18 -04:00
Andrew Kelley fcdd808c5c fix segfault with array of variadic functions
closes #377
2017-05-25 13:48:10 -04:00
Andrew Kelley 68add5d828 clean up behavior test names 2017-05-23 21:38:31 -04:00
Andrew Kelley 1c8fee41c2 add compile error for goto leaving defer expression
closes #284
2017-05-21 10:59:09 -04:00
Andrew Kelley 9f3cca8615 add error for break/continue exiting defer expression
See #284
2017-05-21 10:44:55 -04:00
Andrew Kelley 1c6f415a64 fix compiler crash when indexing types
closes #376
2017-05-21 09:50:15 -04:00
Andrew Kelley 29b488245d add setFloatMode builtin and std.math.floor
* skip installing std/rand_test.zig as it's not needed beyond running
   the std lib tests
 * add std.math.floor function
 * add setFloatMode builtin function to choose between
   builtin.FloatMode.Optimized (default) and builtin.FloatMode.Strict
   (Optimized is equivalent to -ffast-math in gcc)
2017-05-20 23:06:32 -04:00
Andrew Kelley 051ee8e626 change slicing syntax from ... to ..
See #359
2017-05-19 10:39:59 -04:00
Andrew Kelley b483db4868 typeId builtin instead of isInteger, isFloat, etc
closes #373
2017-05-17 12:26:35 -04:00
Andrew Kelley 9851a943ed add compile error for compile-time integer cast truncating bits
closes #371
2017-05-16 17:04:35 -04:00
Andrew Kelley a7570186eb add compile error for comptime division by zero
closes #372
2017-05-14 13:07:45 -04:00
Andrew Kelley 63f6676fee add compile error for casting negative value to...
...unsigned integer at compile-time
2017-05-10 00:21:27 -04:00
Andrew Kelley 6237411716 inline function call with builtin function instead...
...of special syntax.

partially reverts 41144a8566

closes #306
2017-05-09 22:54:23 -04:00
Andrew Kelley 01f066de37 ability to slice ptr to hard coded integer at comptime
closes #369
2017-05-09 22:23:38 -04:00
Andrew Kelley 99f077baf9 zig build: allow calling b.standardReleaseOptions...
...multiple times. See #368
2017-05-09 21:20:09 -04:00
Andrew Kelley 2f20fe6ecd delete @generatedCode builtin function
good riddance
2017-05-07 23:25:36 -04:00
Andrew Kelley e485af94d4 fix inability to initialize global pointer to global array element
closes #366
2017-05-07 18:09:45 -04:00
Andrew Kelley 7261cd19b7 detect duplicate switch value even when else prong present
closes #43
2017-05-07 13:40:35 -04:00
Andrew Kelley dc2df15528 add test case for all prongs unreachable in switch
See #43
2017-05-07 13:26:41 -04:00
Andrew Kelley 11d8a8cc7b fix comptime switch on enum with ref payload
See #43
2017-05-07 13:21:53 -04:00
Andrew Kelley 818a0a2629 switch expression - add compile errors
* for duplicate integer value
   * for missing integer values
   * for missing else prong

see #43
2017-05-07 12:07:35 -04:00
Andrew Kelley 29beb603b7 allow division and remainder operators sometimes
when the values are comptime known and the result would be the same,
allow `/` and `%` for signed integers and floats.

closes #365
2017-05-06 23:59:57 -04:00
Andrew Kelley 157af4332a builtin functions for division and remainder division
* add `@divTrunc` and `@divFloor` functions
 * add `@rem` and `@mod` functions
 * add compile error for `/` and `%` with signed integers
 * add `.bit_count` for float primitive types

closes #217
2017-05-06 23:13:12 -04:00
Andrew Kelley 866c841dd8 add compile error when unable to inline a function
See #38
2017-05-04 15:11:24 -04:00
Andrew Kelley 5c094d7390 std: rename List to ArrayList and re-organize...
...the exports of std.

closes #356
2017-05-04 14:05:06 -04:00
Andrew Kelley b6a679c0ed implement else on loops and break can give an expression
closes #357
2017-05-04 12:43:11 -04:00
Andrew Kelley 20b1491e6b implement while for nullables and error unions
See #357
2017-05-04 10:28:00 -04:00
Andrew Kelley 698829b772 change while syntax
Old:

```
while (condition; expression) {}
```

New:

```
while (condition) : (expression) {}
```

This is in preparation to allow nullable and
error union types as the condition. See #357
2017-05-03 18:12:07 -04:00
Andrew Kelley 644ea2dde9 remove test and try expressions in favor of if expressions
See #357
2017-05-03 17:23:11 -04:00
Andrew Kelley 0940d46c01 add compile error for shadowing variable
closes #360
2017-05-03 16:13:57 -04:00
Andrew Kelley 6756c27ca4 zig build: cache_root is relative to build_root 2017-05-03 16:13:57 -04:00
Andrew Kelley 24a9a42966 add safe release build mode
closes #288
2017-05-02 17:34:21 -04:00
Andrew Kelley 7c236f6dd8 fix compiler crash when referencing a variable...
...in an if after an if in the 2nd switch prong

closes #355
2017-05-02 12:59:09 -04:00
Andrew Kelley 9f92042da9 allow undefined to be resolved with other types
closes #295
2017-05-01 22:37:34 -04:00
Andrew Kelley 3cbd0065fa basic support for specifying packages at the command line
See #226
2017-05-01 16:35:10 -04:00
Andrew Kelley 17b935325e `@import("builtin")` instead of `@compileVar`
See #226
Closes #220
2017-05-01 13:12:38 -04:00
Andrew Kelley 363d9038c9 zig build: organize build artifacts
closes #328
2017-04-30 18:56:24 -04:00
Andrew Kelley 43e7ac8418 add peer type resolution `[]T` and `[0]T`
closes #349

also fix slicing const array to be []const T instead of []T
2017-04-30 12:21:24 -04:00
Andrew Kelley 29defd705d back to AT&T syntax for assembly
this reverts 5c04730534.

sadly the quality of the intel dialect in llvm's assembly
parser has many frustrating bugs, and generally has unfortunate
syntax.

the plan is to use AT&T for now since it at least works,
and eventually zig will have its own assembly parser for
x86 and it will be as close to NASM as possible.
2017-04-30 11:28:11 -04:00
Andrew Kelley cbfe4b4bae add implicit cast from [0]T to %[]T
closes #347

also add std.os.path.relative
2017-04-29 19:23:33 -04:00
Andrew Kelley a147f06585 zig puts temporary object files in zig-cache folder
See #298
2017-04-28 02:22:12 -04:00
Andrew Kelley 458afb0ef9 phi instruction retains stack ptr hint 2017-04-27 23:40:43 -04:00
Andrew Kelley 2e512a0e6e add compile error for returning local variable address
closes #344
2017-04-27 19:40:35 -04:00
Andrew Kelley 7b0542d08b build system: consolidate duplicate code and more
* add ability to add assembly files when building an exe, obj, or lib
 * add implicit cast from `[N]T` to `?[]const T` (closes #343)
 * remove link_exe and link_lib in favor of allowing build_exe and
   build_lib support no root zig source file
2017-04-26 19:17:05 -04:00
Andrew Kelley 09bc4d6ba3 build system: addAssembly and addObject functions
for building executables
2017-04-26 12:56:10 -04:00
Josh Wolfe 08a871f625 defer requires expr to be void. closes #341 2017-04-23 22:33:06 -07:00
Josh Wolfe ac7971122d fix check-statement-is-void. add tests
see #291
2017-04-23 21:50:34 -07:00
Josh Wolfe c6605cba83 blocks check that their statements are void
closes #291

This changes the error message "return value ignored" to "expression value is ignored".
This is because this error also applies to {1;}, which has no function calls.

Also fix ignored expression values in std and test.
This caught a bug in debug.readAllocBytes where an early Eof error would have been missed.
See #219.
2017-04-23 21:15:15 -07:00
Josh Wolfe 14dfbd6ad3 remove redundant unreachable code error 2017-04-23 08:36:21 -07:00
Andrew Kelley 0f633167c5 fix crash when unwrapping error with no error decls
closes #339
2017-04-23 03:14:22 -04:00