ir: Create usize result_loc for array subscript expr

Allow the subscript expression to infer the resulting type.

Closes #4169
This commit is contained in:
LemonBoy
2020-03-03 12:13:13 +01:00
committed by Andrew Kelley
parent 06d0dac0fb
commit e2fd289a33
3 changed files with 30 additions and 6 deletions

View File

@@ -3610,11 +3610,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add("array access of non array",
\\export fn f() void {
\\ var bad : bool = undefined;
\\ bad[bad] = bad[bad];
\\ bad[0] = bad[0];
\\}
\\export fn g() void {
\\ var bad : bool = undefined;
\\ _ = bad[bad];
\\ _ = bad[0];
\\}
, &[_][]const u8{
"tmp.zig:3:8: error: array access of non-array type 'bool'",