aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/dereference_anyopaque.zig
AgeCommit message (Collapse)Author
2025-01-09Sema: rewrite semantic analysis of function callsmlugg
This rewrite improves some error messages, hugely simplifies the logic, and fixes several bugs. One of these bugs is technically a new rule which Andrew and I agreed on: if a parameter has a comptime-only type but is not declared `comptime`, then the corresponding call argument should not be *evaluated* at comptime; only resolved. Implementing this required changing how function types work a little, which in turn required allowing a new kind of function coercion for some generic use cases: function coercions are now allowed to implicitly *remove* `comptime` annotations from parameters with comptime-only types. This is okay because removing the annotation affects only the call site. Resolves: #22262
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2023-09-19write function types consistently with a space before `fn` keywordr00ster91
Currently, the compiler (like @typeName) writes it `fn(...) Type` but zig fmt writes it `fn (...) Type` (notice the space after `fn`). This inconsistency is now resolved and function types are consistently written the zig fmt way. Before this there were more `fn (...) Type` occurrences than `fn(...) Type` already.
2023-08-22compiler: move unions into InternPoolAndrew Kelley
There are a couple concepts here worth understanding: Key.UnionType - This type is available *before* resolving the union's fields. The enum tag type, number of fields, and field names, field types, and field alignments are not available with this. InternPool.UnionType - This one can be obtained from the above type with `InternPool.loadUnionType` which asserts that the union's enum tag type has been resolved. This one has all the information available. Additionally: * ZIR: Turn an unused bit into `any_aligned_fields` flag to help semantic analysis know whether a union has explicit alignment on any fields (usually not). * Sema: delete `resolveTypeRequiresComptime` which had the same type signature and near-duplicate logic to `typeRequiresComptime`. - Make opaque types not report comptime-only (this was inconsistent between the two implementations of this function). * Implement accepted proposal #12556 which is a breaking change.
2022-12-17std.builtin: rename Type.UnionField and Type.StructField's field_type to typer00ster91
2022-11-29std.mem.Allocator: allow shrink to failAndrew Kelley
closes #13535
2022-10-05fix(text): hyphenate "runtime" adjectivesr00ster91
2022-10-05fix(text): hyphenate "comptime" adjectivesr00ster91
2022-07-21fix errors in tests not tested locally or on CIVeikka Tuominen
2022-06-14test-cases: fix race with `zig run` on C backend testsAndrew Kelley
Also avoid redundantly doing compile-error checks on multiple targets for test cases where that is not helpful.
2022-05-26apply Vexu's suggestion to use failing_allocator for nowJakub Konka
2022-05-26test: correctly track identical error msgs in handled errors listJakub Konka
Prior to this change, for an example compiler error test case with multiple identical errors messages such as ``` :1:2: error: foo :1:2: error: foo ``` the test harness would never increment the error index thus only marking the very first error message as handled yielding a false positive. Additionally, while here, regress `dereference_anyopaque` test case as not passing on `wasm32-wasi` target.
2022-05-25Sema: add error for dereferencing comptime value at runtimeVeikka Tuominen