ci: fix failing `v -cstrict vlib/v/tests/channels_test.v`
							parent
							
								
									8fee140fc0
								
							
						
					
					
						commit
						14d09aa7c2
					
				|  | @ -24,7 +24,7 @@ fn (g &Gen) type_to_fmt1(typ ast.Type) StrIntpType { | ||||||
| 	if typ.is_ptr() && (typ.is_int_valptr() || typ.is_float_valptr()) { | 	if typ.is_ptr() && (typ.is_int_valptr() || typ.is_float_valptr()) { | ||||||
| 		return .si_s | 		return .si_s | ||||||
| 	} else if sym.kind in [.struct_, .array, .array_fixed, .map, .bool, .enum_, .interface_, | 	} else if sym.kind in [.struct_, .array, .array_fixed, .map, .bool, .enum_, .interface_, | ||||||
| 		.sum_type, .function, .alias] { | 		.sum_type, .function, .alias, .chan] { | ||||||
| 		return .si_s | 		return .si_s | ||||||
| 	} else if sym.kind == .string { | 	} else if sym.kind == .string { | ||||||
| 		return .si_s | 		return .si_s | ||||||
|  | @ -43,7 +43,6 @@ fn (g &Gen) type_to_fmt1(typ ast.Type) StrIntpType { | ||||||
| 	} else if sym.kind == .i64 { | 	} else if sym.kind == .i64 { | ||||||
| 		return .si_i64 | 		return .si_i64 | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| 	return .si_i32 | 	return .si_i32 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -186,13 +185,15 @@ fn struct_auto_str_func1(sym &ast.TypeSymbol, field_type ast.Type, fn_name strin | ||||||
| 	} else if sym.kind == .function { | 	} else if sym.kind == .function { | ||||||
| 		return '${fn_name}()' | 		return '${fn_name}()' | ||||||
| 	} else { | 	} else { | ||||||
|  | 		if sym.kind == .chan { | ||||||
|  | 			return '${fn_name}(it.${c_name(field_name)})' | ||||||
|  | 		} | ||||||
| 		mut method_str := 'it.${c_name(field_name)}' | 		mut method_str := 'it.${c_name(field_name)}' | ||||||
| 		if sym.kind == .bool { | 		if sym.kind == .bool { | ||||||
| 			method_str += ' ? _SLIT("true") : _SLIT("false")' | 			method_str += ' ? _SLIT("true") : _SLIT("false")' | ||||||
| 		} else if (field_type.is_int_valptr() || field_type.is_float_valptr()) | 		} else if (field_type.is_int_valptr() || field_type.is_float_valptr()) | ||||||
| 			&& field_type.is_ptr() && !expects_ptr { | 			&& field_type.is_ptr() && !expects_ptr { | ||||||
| 			// ptr int can be "nil", so this needs to be castet to a string
 | 			// ptr int can be "nil", so this needs to be casted to a string
 | ||||||
| 
 |  | ||||||
| 			if sym.kind == .f32 { | 			if sym.kind == .f32 { | ||||||
| 				return 'str_intp(1, _MOV((StrIntpData[]){ | 				return 'str_intp(1, _MOV((StrIntpData[]){ | ||||||
| 					{_SLIT0, $si_g32_code, {.d_f32 = *$method_str }} | 					{_SLIT0, $si_g32_code, {.d_f32 = *$method_str }} | ||||||
|  | @ -205,7 +206,6 @@ fn struct_auto_str_func1(sym &ast.TypeSymbol, field_type ast.Type, fn_name strin | ||||||
| 				fmt_type := StrIntpType.si_u64 | 				fmt_type := StrIntpType.si_u64 | ||||||
| 				return 'str_intp(1, _MOV((StrIntpData[]){{_SLIT0, ${u32(fmt_type) | 0xfe00}, {.d_u64 = *$method_str }}}))' | 				return 'str_intp(1, _MOV((StrIntpData[]){{_SLIT0, ${u32(fmt_type) | 0xfe00}, {.d_u64 = *$method_str }}}))' | ||||||
| 			} | 			} | ||||||
| 
 |  | ||||||
| 			fmt_type := StrIntpType.si_i32 | 			fmt_type := StrIntpType.si_i32 | ||||||
| 			return 'str_intp(1, _MOV((StrIntpData[]){{_SLIT0, ${u32(fmt_type) | 0xfe00}, {.d_i32 = *$method_str }}}))' | 			return 'str_intp(1, _MOV((StrIntpData[]){{_SLIT0, ${u32(fmt_type) | 0xfe00}, {.d_i32 = *$method_str }}}))' | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -21,7 +21,7 @@ fn test_printing_of_channels() { | ||||||
| 	res := (go fn1(ch)).wait() | 	res := (go fn1(ch)).wait() | ||||||
| 	println(res) | 	println(res) | ||||||
| 	println(ch) | 	println(ch) | ||||||
| 	assert res.str().contains('another: ') | 	assert res.str().contains('another: chan f64{cap: 100, closed: 0}') | ||||||
| 	assert ch.str() == 'chan St1{cap: 10, closed: 0}' | 	assert ch.str() == 'chan St1{cap: 10, closed: 0}' | ||||||
| 	assert fch.str() == 'chan f64{cap: 100, closed: 0}' | 	assert fch.str() == 'chan f64{cap: 100, closed: 0}' | ||||||
| 	fch.close() | 	fch.close() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue