parent
							
								
									33d379d530
								
							
						
					
					
						commit
						1032cf5c04
					
				|  | @ -119,9 +119,11 @@ fn (mut c Checker) for_in_stmt(mut node ast.ForInStmt) { | ||||||
| 					} | 					} | ||||||
| 					ast.SelectorExpr { | 					ast.SelectorExpr { | ||||||
| 						root_ident := node.cond.root_ident() or { node.cond.expr as ast.Ident } | 						root_ident := node.cond.root_ident() or { node.cond.expr as ast.Ident } | ||||||
| 						if !(root_ident.obj as ast.Var).is_mut { | 						if root_ident.kind != .unresolved { | ||||||
| 							c.error('field `$node.cond.field_name` is immutable, it cannot be changed', | 							if !(root_ident.obj as ast.Var).is_mut { | ||||||
| 								node.cond.pos) | 								c.error('field `$node.cond.field_name` is immutable, it cannot be changed', | ||||||
|  | 									node.cond.pos) | ||||||
|  | 							} | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 					else {} | 					else {} | ||||||
|  |  | ||||||
|  | @ -0,0 +1,13 @@ | ||||||
|  | vlib/v/checker/tests/for_in_invalid_identifier.vv:2:26: error: undefined ident: `s` | ||||||
|  |     1 | fn main() { | ||||||
|  |     2 |     for index, mut value in s.statements { | ||||||
|  |       |                             ^ | ||||||
|  |     3 |         println('Hello $index $value') | ||||||
|  |     4 |     } | ||||||
|  | vlib/v/checker/tests/for_in_invalid_identifier.vv:3:26: error: no known default format for type `void` | ||||||
|  |     1 | fn main() { | ||||||
|  |     2 |     for index, mut value in s.statements { | ||||||
|  |     3 |         println('Hello $index $value') | ||||||
|  |       |                                ~~~~~ | ||||||
|  |     4 |     } | ||||||
|  |     5 | } | ||||||
|  | @ -0,0 +1,5 @@ | ||||||
|  | fn main() { | ||||||
|  | 	for index, mut value in s.statements { | ||||||
|  | 		println('Hello $index $value') | ||||||
|  | 	} | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue