aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig46
1 files changed, 2 insertions, 44 deletions
diff --git a/src/type.zig b/src/type.zig
index 632be95438..2481423cb0 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -1236,7 +1236,7 @@ pub const Type = extern union {
// we can't hash these based on tags because they wouldn't match the expanded version.
.type_info => unreachable, // needed to resolve the type before now
- .bound_fn => unreachable, // TODO delete from the language
+ .bound_fn => unreachable,
.var_args_param => unreachable, // can be any type
}
}
@@ -3272,7 +3272,7 @@ pub const Type = extern union {
.fn_ccc_void_no_args => unreachable, // represents machine code; not a pointer
.function => unreachable, // represents machine code; not a pointer
.@"opaque" => unreachable, // no size available
- .bound_fn => unreachable, // TODO remove from the language
+ .bound_fn => unreachable,
.noreturn => unreachable,
.inferred_alloc_const => unreachable,
.inferred_alloc_mut => unreachable,
@@ -4088,47 +4088,6 @@ pub const Type = extern union {
}
}
- /// Returns if type can be used for a runtime variable
- pub fn isValidVarType(self: Type, is_extern: bool) bool {
- var ty = self;
- while (true) switch (ty.zigTypeTag()) {
- .Bool,
- .Int,
- .Float,
- .ErrorSet,
- .Enum,
- .Frame,
- .AnyFrame,
- => return true,
-
- .Opaque => return is_extern,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .NoReturn,
- .Type,
- .Void,
- .Undefined,
- .Null,
- => return false,
-
- .Optional => {
- var buf: Payload.ElemType = undefined;
- return ty.optionalChild(&buf).isValidVarType(is_extern);
- },
- .Pointer, .Array, .Vector => ty = ty.elemType(),
- .ErrorUnion => ty = ty.errorUnionPayload(),
-
- .Fn => @panic("TODO fn isValidVarType"),
- .Struct => {
- // TODO this is not always correct; introduce lazy value mechanism
- // and here we need to force a resolve of "type requires comptime".
- return true;
- },
- .Union => @panic("TODO union isValidVarType"),
- };
- }
-
/// For *[N]T, returns [N]T.
/// For *T, returns T.
/// For [*]T, returns T.
@@ -5434,7 +5393,6 @@ pub const Type = extern union {
}
/// Asserts the type is an enum or a union.
- /// TODO support unions
pub fn intTagType(ty: Type, buffer: *Payload.Bits) Type {
switch (ty.tag()) {
.enum_full, .enum_nonexhaustive => return ty.cast(Payload.EnumFull).?.data.tag_ty,