aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
AgeCommit message (Collapse)Author
2023-03-03sema: Place functions on AVR in flash addrspaceEckhart Köppen
- Use .flash as the default address space for functions on AVR - Return .flash as the address space for function pointers on AVR without explicit address space
2023-02-21Merge pull request #14664 from mlugg/feat/new-module-cliAndrew Kelley
New module CLI
2023-02-21Sema: implement @fieldParentPtr for unionsIsaac Freund
2023-02-21Implement new module CLImlugg
2023-02-19implement `writeToMemory`/`readFromMemory` for pointersVeikka Tuominen
2023-02-18Sema: add missing coercion when checking for loop lenAndrew Kelley
2023-02-18omit safety check when incrementing for loop counterAndrew Kelley
Since for loops are statically analyzed to have an upper bound, and the loop counter is a usize, it is impossible for it to overflow.
2023-02-18implement error for unbounded for loopsAndrew Kelley
2023-02-18omit safety checks for element access in for loopsAndrew Kelley
One of the main points of for loops is that you can safety check the length once, before entering the loop, and then safely assume that every element inside the loop is in bounds. In master branch, the safety checks are incorrectly intact even inside for loops. This commit fixes it. It's especially nice with multi-object loops because the number of elided checks is N * M where N is how many iterations and M is how many objects.
2023-02-18improve error message for byref capture of byval arrayAndrew Kelley
2023-02-18fix source location for not-indexable for loop errorsAndrew Kelley
2023-02-18Sema: improve error message for mismatched for loop lengthsAndrew Kelley
2023-02-18Sema: fix for loops with comptime-known int rangesAndrew Kelley
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-02-18Sema: implement for_lenAndrew Kelley
This also makes another breaking change to for loops: in order to capture a pointer of an element, one must take the address of array values. This simplifies a lot of things, and makes more sense than how it was before semantically. It is still legal to use a for loop on an array value if the corresponding element capture is byval instead of byref.
2023-02-18AstGen: back to index-based for loopsAndrew Kelley
2023-02-18AstGen: finish multi-object for loopsAndrew Kelley
This strategy uses pointer arithmetic to iterate through the loop. This has a problem, however, which is tuples. AstGen does not know whether a given indexable is a tuple or can be iterated based on contiguous memory. Tuples unlike other indexables cannot be represented as a many-item pointer that is incremented as the loop counter. So, after this commit, I will modify AstGen back closer to how @vexu had it before, using a counter and array element access.
2023-02-18AstGen: rework multi-object for loopAndrew Kelley
* Allow unbounded looping. * Lower by incrementing raw pointers for each iterable rather than incrementing a single index variable. This elides safety checks without any analysis required thanks to the length assertion and lowers to decent machine code even in debug builds. - An "end" value is selected, prioritizing a counter if possible, falling back to a runtime calculation of ptr+len on a slice input. * Specialize on the pattern `0..`, avoiding an unnecessary subtraction instruction being emitted. * Add the `for_check_lens` ZIR instruction.
2023-02-15split `@qualCast` into `@constCast` and `@volatileCast`Veikka Tuominen
2023-02-11Sema: fix typo in `zirCUndef`Veikka Tuominen
Closes #14617
2023-02-11Sema: add missing peer type resolution for error unionsVeikka Tuominen
Closes #14077
2023-02-11Sema: validate inferred error set payload typeVeikka Tuominen
This was missed in b0a55e1b3be3a274546f9c18016e9609d546bdb0
2023-02-01Merge pull request #14477 from Vexu/fixesAndrew Kelley
Improve `@ptrCast` errors, fix some bugs
2023-02-02Merge pull request #14502 from ziglang/link-owned-atomsJakub Konka
link: move ownership of linker atom from frontend to the linkers
2023-02-01Sema: fix error location on comptime arg to typed generic paramVeikka Tuominen
Closes #14505
2023-02-01link: remove union types which are now internal to backendsJakub Konka
2023-02-01link: make Wasm atoms fully owned by the linkerLuuk de Gram
2023-02-01link: make Plan9 atoms fully owned by the linkerJakub Konka
2023-01-31move compiler's CType logic to std.TargetAndrew Kelley
This API only depends on std.Target and is extremely useful in build scripts when populating configure files.
2023-01-31link: make Coff atoms fully owned by the linkerJakub Konka
2023-01-31link: make Elf atoms fully owned by the linkerJakub Konka
2023-01-31Sema: emit compile error for comptime or inline call of function pointerr00ster91
2023-01-31link: make MachO atoms fully owned by the linkerJakub Konka
2023-01-30implement `@qualCast`Veikka Tuominen
2023-01-30Sema: replace backticks with single quotesVeikka Tuominen
Most error messages already use single quotes for everything so this makes the remaining ones consistent.
2023-01-30Sema: add helpful notes to invalid `@ptrCast` operationsVeikka Tuominen
Closes #14474
2023-01-30Sema: ensure args to inline comptime args are comptime-knownVeikka Tuominen
Closes #14413
2023-01-27self-hosted: remove allocateDeclIndexes from the public link.File APIJakub Konka
2023-01-22Package: store package name directlymlugg
By @Vexu's suggestion, since fetching the name from the parent package is error-prone and complex, and optimising Package for size isn't really a priority.
2023-01-22Sema: fix error message for bad pointer arithmeticVeikka Tuominen
Closes #14388
2023-01-22Sema: fix unwrapping null when reporting error on member accessVeikka Tuominen
Closes #14399
2023-01-22Sema: resolve fields before checking tuple lenVeikka Tuominen
Closes #14400
2023-01-22Value: implement `compareAllWithZero` for `bytes` and `str_lit`Veikka Tuominen
Closes #10692
2023-01-22Sema: handle lazy values in more placesVeikka Tuominen
* resolve lazy values in anon structs being passed to anytype params * use `resolveMaybeUndefValIntable` where appropriate Closes #14356
2023-01-17Sema: do not create slices with undefined pointersVeikka Tuominen
The undef pointer ended up being zero on wasm32.
2023-01-17Sema: fix bad boolean logic for cast to null panicVeikka Tuominen
Closes #14349
2023-01-17Sema: promote smaller float types passed to variadic functionsVeikka Tuominen
Closes #6854
2023-01-17Sema: resolve lazy values in switch prong itemsVeikka Tuominen
Closes #14330
2023-01-17Sema: ignore dependency loops in typeinfo declsVeikka Tuominen
This matches stage1 behavior. Closes #14322
2023-01-16Sema: automatically optimize order of struct fieldsVeikka Tuominen
This is a simple starting version of the optimization described in #168 where the fields are just sorted by order of descending alignment.