aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-11-23 17:51:37 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-11-23 17:51:37 -0500
commitf25182f46dd672eb5b10533c67ed462a3e5df999 (patch)
tree142c56629394684cb2d7e15418dbda98ae2fd1a3 /src/analyze.cpp
parent7597735badd1f6aa6750f354a7e9c85fec705c55 (diff)
downloadzig-f25182f46dd672eb5b10533c67ed462a3e5df999.tar.gz
zig-f25182f46dd672eb5b10533c67ed462a3e5df999.zip
structs can have fields with type `var`
behavior tests passing now
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index aa58d64aa4..d065f85c67 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -1179,6 +1179,10 @@ Error type_val_resolve_zero_bits(CodeGen *g, ConstExprValue *type_val, ZigType *
Error type_val_resolve_is_opaque_type(CodeGen *g, ConstExprValue *type_val, bool *is_opaque_type) {
if (type_val->special != ConstValSpecialLazy) {
assert(type_val->special == ConstValSpecialStatic);
+ if (type_val->data.x_type == g->builtin_types.entry_var) {
+ *is_opaque_type = false;
+ return ErrorNone;
+ }
*is_opaque_type = (type_val->data.x_type->id == ZigTypeIdOpaque);
return ErrorNone;
}
@@ -3667,6 +3671,7 @@ void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node) {
case NodeTypeEnumLiteral:
case NodeTypeAnyFrameType:
case NodeTypeErrorSetField:
+ case NodeTypeVarFieldType:
zig_unreachable();
}
}
@@ -5587,6 +5592,9 @@ ConstExprValue *get_the_one_possible_value(CodeGen *g, ZigType *type_entry) {
ReqCompTime type_requires_comptime(CodeGen *g, ZigType *ty) {
Error err;
+ if (ty == g->builtin_types.entry_var) {
+ return ReqCompTimeYes;
+ }
switch (ty->id) {
case ZigTypeIdInvalid:
zig_unreachable();