fix implicit cast to optional to error union to return result loc

This commit is contained in:
Andrew Kelley
2019-06-21 17:49:54 -04:00
parent 5441f77672
commit ff6d563b04
3 changed files with 24 additions and 5 deletions

View File

@@ -4512,6 +4512,8 @@ bool fn_eval_cacheable(Scope *scope, ZigType *return_type) {
ScopeVarDecl *var_scope = (ScopeVarDecl *)scope;
if (type_is_invalid(var_scope->var->var_type))
return false;
if (var_scope->var->const_value->special == ConstValSpecialUndef)
return false;
if (can_mutate_comptime_var_state(var_scope->var->const_value))
return false;
} else if (scope->id == ScopeIdFnDef) {