cgen: fix error for time struct init with update (#13660)
							parent
							
								
									8136157f87
								
							
						
					
					
						commit
						22fda7c3dd
					
				| 
						 | 
				
			
			@ -245,7 +245,7 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
 | 
			
		|||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				g.write(field.name)
 | 
			
		||||
				g.write(c_name(field.name))
 | 
			
		||||
			} else {
 | 
			
		||||
				if !g.zero_struct_field(field) {
 | 
			
		||||
					nr_fields--
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
import time
 | 
			
		||||
 | 
			
		||||
fn test_struct_of_time_init_with_update() {
 | 
			
		||||
	utc := time.utc()
 | 
			
		||||
 | 
			
		||||
	t := time.Time{
 | 
			
		||||
		...utc
 | 
			
		||||
	}
 | 
			
		||||
	println(utc)
 | 
			
		||||
	println(t)
 | 
			
		||||
	assert t == utc
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue