aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-06-19 11:01:41 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-06-19 11:01:41 -0400
commit799c69910172a7248ab9db366e6e3a6556e7d626 (patch)
tree000c3e87de36873028b0fed44c4864c0baaa55eb /src/ir.cpp
parent4efb9ae2e5525bc807b626c83b8e83cf8d730994 (diff)
parent62b23f5da5a29f54499f5339bc0f98c06e27af8f (diff)
downloadzig-799c69910172a7248ab9db366e6e3a6556e7d626.tar.gz
zig-799c69910172a7248ab9db366e6e3a6556e7d626.zip
Merge branch 'master' into math
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index c327722612..d1f14baf8e 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -6460,6 +6460,9 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
prev_inst = cur_inst;
continue;
} else if (cur_type->id == TypeTableEntryIdPureError) {
+ if (prev_type->id == TypeTableEntryIdArray) {
+ convert_to_const_slice = true;
+ }
any_are_pure_error = true;
continue;
} else if (cur_type->id == TypeTableEntryIdNullLit) {
@@ -6568,7 +6571,12 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
}
if (convert_to_const_slice) {
assert(prev_inst->value.type->id == TypeTableEntryIdArray);
- return get_slice_type(ira->codegen, prev_inst->value.type->data.array.child_type, true);
+ TypeTableEntry *slice_type = get_slice_type(ira->codegen, prev_inst->value.type->data.array.child_type, true);
+ if (any_are_pure_error) {
+ return get_error_type(ira->codegen, slice_type);
+ } else {
+ return slice_type;
+ }
} else if (any_are_pure_error && prev_inst->value.type->id != TypeTableEntryIdPureError) {
if (prev_inst->value.type->id == TypeTableEntryIdNumLitInt ||
prev_inst->value.type->id == TypeTableEntryIdNumLitFloat)