| ... | @@ -6372,11 +6372,9 @@ fn identifier( | ... | @@ -6372,11 +6372,9 @@ fn identifier( |
| 6372 | | 6372 | |
| 6373 | if (local_val.name == name_str_index) { | 6373 | if (local_val.name == name_str_index) { |
| 6374 | local_val.used = true; | 6374 | local_val.used = true; |
| 6375 | // Captures of non-locals need to be emitted as decl_val or decl_ref. | 6375 | // Locals cannot shadow anything, so we do not need to look for ambiguous |
| 6376 | // This *might* be capturable depending on if it is comptime known. | 6376 | // references in this case. |
| 6377 | if (hit_namespace == 0) { | 6377 | return rvalue(gz, rl, local_val.inst, ident); |
| 6378 | return rvalue(gz, rl, local_val.inst, ident); | | |
| 6379 | } | | |
| 6380 | } | 6378 | } |
| 6381 | s = local_val.parent; | 6379 | s = local_val.parent; |
| 6382 | }, | 6380 | }, |
| ... | @@ -6384,14 +6382,11 @@ fn identifier( | ... | @@ -6384,14 +6382,11 @@ fn identifier( |
| 6384 | const local_ptr = s.cast(Scope.LocalPtr).?; | 6382 | const local_ptr = s.cast(Scope.LocalPtr).?; |
| 6385 | if (local_ptr.name == name_str_index) { | 6383 | if (local_ptr.name == name_str_index) { |
| 6386 | local_ptr.used = true; | 6384 | local_ptr.used = true; |
| 6387 | if (hit_namespace != 0) { | 6385 | if (hit_namespace != 0 and !local_ptr.maybe_comptime) { |
| 6388 | if (local_ptr.maybe_comptime) | 6386 | return astgen.failNodeNotes(ident, "mutable '{s}' not accessible from here", .{ident_name}, &.{ |
| 6389 | break | 6387 | try astgen.errNoteTok(local_ptr.token_src, "declared mutable here", .{}), |
| 6390 | else | 6388 | try astgen.errNoteNode(hit_namespace, "crosses namespace boundary here", .{}), |
| 6391 | return astgen.failNodeNotes(ident, "mutable '{s}' not accessible from here", .{ident_name}, &.{ | 6389 | }); |
| 6392 | try astgen.errNoteTok(local_ptr.token_src, "declared mutable here", .{}), | | |
| 6393 | try astgen.errNoteNode(hit_namespace, "crosses namespace boundary here", .{}), | | |
| 6394 | }); | | |
| 6395 | } | 6390 | } |
| 6396 | switch (rl) { | 6391 | switch (rl) { |
| 6397 | .ref, .none_or_ref => return local_ptr.ptr, | 6392 | .ref, .none_or_ref => return local_ptr.ptr, |