Commit f80c01f9d8
lib/std/math.zig
@@ -202,54 +202,8 @@ pub const Complex = complex.Complex;
pub const big = @import("math/big.zig");
-test "math" {
- _ = @import("math/nan.zig");
- _ = @import("math/isnan.zig");
- _ = @import("math/fabs.zig");
- _ = @import("math/ceil.zig");
- _ = @import("math/floor.zig");
- _ = @import("math/trunc.zig");
- _ = @import("math/round.zig");
- _ = @import("math/frexp.zig");
- _ = @import("math/modf.zig");
- _ = @import("math/copysign.zig");
- _ = @import("math/isfinite.zig");
- _ = @import("math/isinf.zig");
- _ = @import("math/isnormal.zig");
- _ = @import("math/signbit.zig");
- _ = @import("math/scalbn.zig");
- _ = @import("math/pow.zig");
- _ = @import("math/powi.zig");
- _ = @import("math/sqrt.zig");
- _ = @import("math/cbrt.zig");
- _ = @import("math/acos.zig");
- _ = @import("math/asin.zig");
- _ = @import("math/atan.zig");
- _ = @import("math/atan2.zig");
- _ = @import("math/hypot.zig");
- _ = @import("math/exp.zig");
- _ = @import("math/exp2.zig");
- _ = @import("math/expm1.zig");
- _ = @import("math/ilogb.zig");
- _ = @import("math/ln.zig");
- _ = @import("math/log.zig");
- _ = @import("math/log2.zig");
- _ = @import("math/log10.zig");
- _ = @import("math/log1p.zig");
- _ = @import("math/fma.zig");
- _ = @import("math/asinh.zig");
- _ = @import("math/acosh.zig");
- _ = @import("math/atanh.zig");
- _ = @import("math/sinh.zig");
- _ = @import("math/cosh.zig");
- _ = @import("math/tanh.zig");
- _ = @import("math/sin.zig");
- _ = @import("math/cos.zig");
- _ = @import("math/tan.zig");
-
- _ = @import("math/complex.zig");
-
- _ = @import("math/big.zig");
+comptime {
+ std.meta.refAllDecls(@This());
}
pub fn floatMantissaBits(comptime T: type) comptime_int {
lib/std/meta.zig
@@ -552,3 +552,9 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int {
}
return null;
}
+
+/// Given a type, reference all the declarations inside, so that the semantic analyzer sees them.
+pub fn refAllDecls(comptime T: type) void {
+ if (!builtin.is_test) return;
+ _ = declarations(T);
+}
lib/std/std.zig
@@ -62,69 +62,6 @@ pub const unicode = @import("unicode.zig");
pub const valgrind = @import("valgrind.zig");
pub const zig = @import("zig.zig");
-// Reference everything so it gets tested.
-test "" {
- _ = AlignedArrayList;
- _ = ArrayList;
- _ = AutoHashMap;
- _ = BloomFilter;
- _ = BufMap;
- _ = BufSet;
- _ = Buffer;
- _ = BufferOutStream;
- _ = DynLib;
- _ = HashMap;
- _ = Mutex;
- _ = PackedIntArrayEndian;
- _ = PackedIntArray;
- _ = PackedIntSliceEndian;
- _ = PackedIntSlice;
- _ = PriorityQueue;
- _ = SinglyLinkedList;
- _ = StaticallyInitializedMutex;
- _ = SegmentedList;
- _ = SpinLock;
- _ = StringHashMap;
- _ = ChildProcess;
- _ = TailQueue;
- _ = Thread;
-
- _ = atomic;
- _ = base64;
- _ = build;
- _ = c;
- _ = coff;
- _ = crypto;
- _ = cstr;
- _ = debug;
- _ = dwarf;
- _ = elf;
- _ = event;
- _ = fmt;
- _ = fs;
- _ = hash;
- _ = hash_map;
- _ = heap;
- _ = http;
- _ = io;
- _ = json;
- _ = lazyInit;
- _ = macho;
- _ = math;
- _ = mem;
- _ = meta;
- _ = net;
- _ = os;
- _ = packed_int_array;
- _ = pdb;
- _ = process;
- _ = rand;
- _ = rb;
- _ = sort;
- _ = ascii;
- _ = testing;
- _ = time;
- _ = unicode;
- _ = valgrind;
- _ = zig;
+comptime {
+ meta.refAllDecls(@This());
}