aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
AgeCommit message (Collapse)Author
2022-08-27Sema: add error for non-comptime param in comptime funcantlilja
Adds error for taking a non comptime parameter in a function returning a comptime-only type but not when that type is dependent on a parameter. Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-08-24Adds std.meta.FnPtr for easier stage1/stage2 compatibilityFelix "xq" Queißner
2022-08-05Makes std.meta.Tuple and std.meta.ArgsTuple generate a unique type instead ↵Felix "xq" Queißner
of generating one per invocation.
2022-06-03std: update tests to stage2 semanticsVeikka Tuominen
2022-05-04std.meta.TrailerFlags: include in std testsErik Arvstedt
Previously, TrailerFlags was unreferenced in std, so its tests were never run. Also, fix the use of `default_value` whose type was changed in f4a249325e8e3741a6294462ae37a79cb9089c56 (#10766).
2022-04-27std.meta: deprecate bitCount() for @bitSizeOf()Isaac Freund
2022-04-26Remove usage of inline for from print_targets.cmdTargetsJimmi Holst Christensen
This function was one of the biggest zig functions in a debug build of the compiler. $ bloaty stage3-debug/bin/zig -d symbols --tsv -n 10000000 | rg -v '(llvm|clang|std|lld|\(anonymous namespace\))::|\[section ' | sort -h -k 3 ... translate_c.ast.renderNode 86168 86219 main.buildOutputType 177959 178004 InfoTable 184832 184870 AArch64SVEIntrinsicMap 188544 188596 print_targets.cmdTargets__anon_4735 319156 319216 __static_initialization_and_destruction_0() 486666 489582 MatchTable1 621884 621997 OperandMatchTable 1139622 1139861 MatchTable0 1899764 1900141
2022-03-24std.meta: fix unit tests depending on unstable behaviorAndrew Kelley
The unit tests of std.meta depended on `@typeInfo` for the same type returning a slice of declarations and fields with the same pointer address. This is not something guaranteed by the language specification.
2022-03-23stage2: fix some generics issuesAndrew Kelley
* std.meta: correct use of `default_value` in reification. stage1 accepted a wrong type for `null`. * Sema: after instantiating a generic function, if the return type ends up being a comptime-known type, then we return an error, undoing the generic function instantiation, and making a comptime function call instead. - We also needed to clean up the dependency graph in this case. * Sema: reified enums set tag_ty_inferred to false since an integer tag type is provided. This is a limitation of the `@Type` builtin which will be addressed with #10710. * Sema: fix resolveInferredErrorSet incorrectly calling ensureFuncBodyAnalyzed on generic functions.
2022-03-14basic language features do not belong in std.metaAndrew Kelley
2022-03-08deprecated TypeInfo in favor of TypeJonathan Marler
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-02-01stage1: avoid anytype fields for type infoAndrew Kelley
prerequisite for #10705
2022-01-31a small crusade against std.meta.declarationsAndrew Kelley
2022-01-20std: add meta.DeclEnumMeghan Denny
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-11-22Add std.meta.Float, alongside std.meta.IntLewis Gaul
2021-10-29Use `debug.assert` instead of `testing.expect`.InKryption
`testing.expect` and friends are intended to be used only in tests; this change reflects that intention.
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-09-20Address Spaces: Pointer and function info in @TypeRobin Voetter
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-06-21fix code broken from previous commitJacob G-W
2021-06-21std, src, doc, test: remove unused variablesJacob G-W
2021-06-14translate-c: move utility functions to a separate namespaceVeikka Tuominen
2021-06-13meta.cast: handle casts from negative ints to ptrsVeikka Tuominen
2021-06-11translate-c: Implement flexible arraysEvan Haas
Fixes #8759
2021-05-12Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * lib/std/os/linux.zig * lib/std/os/windows/bits.zig * src/Module.zig * src/Sema.zig * test/stage2/test.zig Mainly I wanted Jakub's new macOS code for respecting stack size, since we now depend on it for debug builds able to pass one of the test cases for recursive comptime function calls with `@setEvalBranchQuota`. The conflicts were all trivial.
2021-05-11std.meta.Elem: support all optional typesIsaac Freund
2021-05-08Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * doc/langref.html.in * lib/std/enums.zig * lib/std/fmt.zig * lib/std/hash/auto_hash.zig * lib/std/math.zig * lib/std/mem.zig * lib/std/meta.zig * test/behavior/alignof.zig * test/behavior/bitcast.zig * test/behavior/bugs/1421.zig * test/behavior/cast.zig * test/behavior/ptrcast.zig * test/behavior/type_info.zig * test/behavior/vector.zig Master branch added `try` to a bunch of testing function calls, and some lines also had changed how to refer to the native architecture and other `@import("builtin")` stuff.
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-04-29std: fix compile errors found by stage2 AstGenAndrew Kelley
2021-04-28Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
In particular I wanted to take advantage of the new hex float parsing code.
2021-04-25Merge pull request #8616 from LemonBoy/fn-alignAndrew Kelley
Function pointer alignment
2021-04-25Merge pull request #8496 from xackus/isErrorAndrew Kelley
std.meta: add isError
2021-04-25std: Make met.alignment work on more typesLemonBoy
Make it return the correct value for function types and optional pointers.
2021-04-24Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
In particular I wanted the change that makes `suspend;` illegal in the parser.
2021-04-22std: fix compile errors caught by stage2 AstGenAndrew Kelley
* `comptime const` is redundant * don't use `extern enum`; specify a tag type. `extern enum` is only when you need tags to alias. But aliasing tags is a smell. I will be making a proposal shortly to remove `extern enum` from the language. * there is no such thing as `packed enum`. * instead of `catch |_|`, omit the capture entirely. * unused function definition with missing parameter name * using `try` outside of a function or test
2021-04-15translate-c: better handling of int -> enum castsEvan Haas
In std.meta.cast when casting to an enum type from an integer type, first do a C-style cast from the source value to the tag type of the enum. This ensures that we don't get an error due to the source value not being representable by the enum. In transCCast() use std.meta.cast instead of directly emitting the cast operation since the enum's underlying type may not be known at translation time due to an MSVC bug, see https://github.com/ziglang/zig/issues/8003 Fixes #6011
2021-04-15std: change `@import("builtin")` to `std.builtin`Andrew Kelley
2021-04-11zig fmtxackus
2021-04-11std.meta: add isErrorxackus
2021-04-08translate-c: fix meta.cast to ?*c_voidxackus
2021-04-06translate-c: Add support for vector expressionsEvan Haas
Includes vector types, __builtin_shufflevector, and __builtin_convertvector
2021-03-17translate-c: improve std.meta.castxackus
2021-03-05add testsxackus
2021-03-05remove redundant castMaciej Walczak
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2021-03-05translate-c: promote int literals to bigger typesxackus
2021-02-24zig fmt the std libAndrew Kelley
2021-01-30Replace @TagType uses, mostly with std.meta.TagTadeo Kondrak
2021-01-30std.meta: rename TagPayloadType to TagPayloadTadeo Kondrak
2021-01-30std.meta: rename TagType to TagTadeo Kondrak