checker: check undefined ident of struct (#9164)
							parent
							
								
									f1c4e962f4
								
							
						
					
					
						commit
						1b47e2953d
					
				| 
						 | 
				
			
			@ -1063,6 +1063,9 @@ fn (mut c Checker) fail_if_immutable(expr ast.Expr) (string, token.Position) {
 | 
			
		|||
			to_lock, pos = c.fail_if_immutable(expr.right)
 | 
			
		||||
		}
 | 
			
		||||
		ast.SelectorExpr {
 | 
			
		||||
			if expr.expr_type == 0 {
 | 
			
		||||
				return '', pos
 | 
			
		||||
			}
 | 
			
		||||
			// retrieve table.Field
 | 
			
		||||
			c.ensure_type_exists(expr.expr_type, expr.pos) or { return '', pos }
 | 
			
		||||
			mut typ_sym := c.table.get_final_type_symbol(c.unwrap_generic(expr.expr_type))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
vlib/v/checker/tests/undefined_ident_of_struct.vv:4:2: error: undefined ident: `f`
 | 
			
		||||
    2 |
 | 
			
		||||
    3 | fn get()  {
 | 
			
		||||
    4 |     f.a = 'test'
 | 
			
		||||
      |     ^
 | 
			
		||||
    5 | }
 | 
			
		||||
    6 |
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module main
 | 
			
		||||
 | 
			
		||||
fn get()  {
 | 
			
		||||
	f.a = 'test'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn main() {
 | 
			
		||||
	println('hello')
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue