aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
AgeCommit message (Collapse)Author
2023-12-11Revert "Sema: forbid @breakpoint from being called at comptime"Andrew Kelley
This reverts commit f88b523065fbb8afbd723fd6e803ace0334b713c. Let's please go through the language proposal process for this change. I don't see any justification for this breaking change even in the commit message.
2023-12-11Sema: forbid @breakpoint from being called at comptimeBogdan Romanyuk
2023-12-03Coff: minor fixesJacob Young
* Update the msdos stub to be eight bytes smaller, which moves the machine PE header field into the first 128 bytes of the file, allowing it to be matched by a binfmt_misc magic sequence. This allows the build system to get the correct error during exec. * Fix library name memory leaks in Sema.
2023-12-03Air: use typesafe `Air.Inst.Index`Jacob Young
I need some indices for a thing...
2023-12-01test: test with `-fstrip` and fix failuresJacob Young
Closes #17513
2023-11-30Sema: improve error location for array cat/mulVeikka Tuominen
2023-11-26move Module.Decl.Index and Module.Namespace.Index to InternPoolMeghan Denny
2023-11-25Compiler: move checking function-scope-only builtins to AstGenBogdan Romanyuk
2023-11-25Sema: ensure tuple fields is resolved and fix internal out-of-bounds accessBogdan Romanyuk
2023-11-25convert `toType` and `toValue` to `Type.fromInterned` and `Value.fromInterned`Techatrix
2023-11-23fix spellingDavid Rubin
2023-11-23Sema: disallow call to undefined functionBogdan Romanyuk
2023-11-21Sema: fix bad error location on field init with field accessVeikka Tuominen
Closes #14753
2023-11-19compiler: correct unnecessary uses of 'var'mlugg
2023-11-19test: check compile errors when compilation has no errorsdweiller
2023-11-18Add struct declaration location to empty root struct field member errorCurtis Tate Wilkinson
2023-11-16Sema: include sentinel in type of pointer-to-array `ptr` fieldDavid
Resolves: #18007
2023-11-16Move duplicate field detection for struct init expressions into AstGenDavid
Partially addresses #17916.
2023-11-16Sema: Add error for non-power of 2 field alignment when reifying Unions, ↵Krzysztof Wolicki
Structs, Pointers
2023-11-12sema: fixup underflows during struct / ptr array init when using -fstripkcbanner
2023-11-12Revert "Sema: fix comparison with undefined"Andrew Kelley
This reverts commit 547481c31c8a538a7badbdce66d81820177ce87f. There is a comment that did not get addressed with this patch, and the required test cases are not added. Reopens #17798.
2023-11-12Sema: fix comparison with undefinedBogdan Romanyuk
2023-11-10Sema: detect unneeded source locations earlierJacob Young
This avoids a lot of work that just needs deferred cleanup anyway. Crucially, also avoids use of undefined in `failWithNeededComptime`.
2023-11-10disallow calling @trap at comptimeBogdan Romanyuk
2023-11-10Sema: do not allow comptime-only pointer fields in packed structsmlugg
2023-11-10Sema: remove unused functionmlugg
2023-11-09preserve 'undefined' in @bitCastBogdan Romanyuk
2023-11-08Sema: optimize runtime array_mulmlugg
There are two optimizations here, which work together to avoid a pathological case. The first optimization is that AstGen now records the result type of an array multiplication expression where possible. This type is not used according to the language specification, but instead as an optimization. In the expression '.{x} ** 1000', if we know that the result must be an array, then it is much more efficient to coerce the LHS to an array with length 1 before doing the multiplication. Otherwise, we end up with a 1000-element tuple which we must coerce to an array by individually extracting each field. Secondly, the previous logic would repeatedly extract element/field values from the LHS when initializing the result. This is unnecessary: each element must only be extracted once, and the result reused. These changes together give huge improvements to compiler performance on a pathological case: AIR instructions go from 65551 to 15, and total AIR bytes go from 1.86MiB to 264.57KiB. Codegen time spent on this function (in a debug compiler build) goes from minutes to essentially zero. Resolves: #17586
2023-11-08Merge pull request #17913 from jacobly0/vararg-intAndrew Kelley
Sema: implement vararg integer promotions
2023-11-08Sema: do not force resolution of struct field inits when calling function ↵mlugg
pointer field b3462b7 caused a regression in a third-party project, since it forced resolution of field initializers for any field call 'foo.bar()', despite this only being necessary when 'bar' is a comptime field. See https://github.com/ziglang/zig/pull/17692#issuecomment-1802096734.
2023-11-08Sema: don't allow passing non-extern types to varargs parametersJacob Young
2023-11-08Sema: implement vararg integer promotionsJacob Young
2023-11-08Sema: fix source location for untyped array init with result typemlugg
Resolves: #17923
2023-11-07sema: allow slicing [*]T without enddweiller
2023-11-07Merge pull request #17692 from kcbanner/struct_field_init_passMatthew Lugg
sema: analyze struct field bodies in a second pass, to allow them to use the layout of the struct itself
2023-11-07Sema: emit @intCast safety check correctly for vectorsmlugg
This code was previously tripping an assertion by not making this value used in the safety check a vector.
2023-11-07Sema: allow destructuring vectorsmlugg
This was intended to work when destructuring was first implemented, and was just unintentionally missed out.
2023-11-07sema: analyze field init bodies in a second passkcbanner
This change allows struct field inits to use layout information of their own struct without causing a circular dependency. `semaStructFields` caches the ranges of the init bodies in the `StructType` trailing data. The init bodies are then resolved by `resolveStructFieldInits`, which is called before the inits are actually required. Within the init bodies, the struct decl's instruction is repurposed to refer to the field type itself. This is to allow us to easily rebuild the inst_map mapping required for the init body instructions to refer to the field type. Thanks to @mlugg for the guidance on this one!
2023-11-06Sema: emit error when pointer to extern function is calledBogdan Romanyuk
2023-11-05src: fix memory leaksJacob Young
2023-11-05Sema: fix error notes with wrong extern typeBogdan Romanyuk
2023-11-05Sema: fix memory leak in zirTypeInfoAndrew Kelley
2023-11-03frontend: rip out Decl dependenciesAndrew Kelley
This incremental compilation logic will need to be reworked so that it does not depend on buried pointers - that is, long-lived pointers that are owned by non-top-level objects such as Decl. In the meantime, this fixes memory leaks since the memory management of these dependencies has bitrotted.
2023-11-03Sema: use correct error bit length when emitting error_set_has_value safety ↵mlugg
checks Resolves: #17843
2023-10-31std.builtin.Endian: make the tags lower caseAndrew Kelley
Let's take this breaking change opportunity to fix the style of this enum.
2023-10-31Sema: fix incorrect error comptime-mutating empty arrayJacob Young
2023-10-31sema: when guessing union alignment, save the result and check if the guess ↵kcbanner
was correct
2023-10-31sema: Add union alignment resolutionkcbanner
- Add resolveUnionAlignment, to resolve a union's alignment only, without triggering layout resolution. - Update resolveUnionLayout to cache size, alignment, and padding. abiSizeAdvanced and abiAlignmentAdvanced now use this information instead of computing it each time.
2023-10-28make Zir.Inst.Index typedAndrew Kelley
This commit starts by making Zir.Inst.Index a nonexhaustive enum rather than a u32 alias for type safety purposes, and the rest of the changes are needed to get everything compiling again.
2023-10-28Sema: do not assume switch item indices align with union field indicesmlugg
Resolves: #17754