| ... | @@ -1234,14 +1234,19 @@ static bool num_lit_fits_in_other_type(CodeGen *g, AstNode *literal_node, TypeTa | ... | @@ -1234,14 +1234,19 @@ static bool num_lit_fits_in_other_type(CodeGen *g, AstNode *literal_node, TypeTa |
| 1234 | { | 1234 | { |
| 1235 | return true; | 1235 | return true; |
| 1236 | } | 1236 | } |
| 1237 | } else if (other_type->id == TypeTableEntryIdNumLitFloat || | 1237 | } else if ((other_type->id == TypeTableEntryIdNumLitFloat && |
| 1238 | other_type->id == TypeTableEntryIdNumLitInt) | 1238 | const_val->data.x_bignum.kind == BigNumKindFloat) || |
| | 1239 | (other_type->id == TypeTableEntryIdNumLitInt && |
| | 1240 | const_val->data.x_bignum.kind == BigNumKindInt)) |
| 1239 | { | 1241 | { |
| 1240 | return true; | 1242 | return true; |
| 1241 | } | 1243 | } |
| 1242 | | 1244 | |
| | 1245 | const char *num_lit_str = (const_val->data.x_bignum.kind == BigNumKindFloat) ? "float" : "integer"; |
| | 1246 | |
| 1243 | add_node_error(g, literal_node, | 1247 | add_node_error(g, literal_node, |
| 1244 | buf_sprintf("value %s cannot be represented in type '%s'", | 1248 | buf_sprintf("%s value %s cannot be implicitly casted to type '%s'", |
| | 1249 | num_lit_str, |
| 1245 | buf_ptr(bignum_to_buf(&const_val->data.x_bignum)), | 1250 | buf_ptr(bignum_to_buf(&const_val->data.x_bignum)), |
| 1246 | buf_ptr(&other_type->name))); | 1251 | buf_ptr(&other_type->name))); |
| 1247 | return false; | 1252 | return false; |
| ... | @@ -1351,14 +1356,6 @@ static TypeTableEntry *determine_peer_type_compatibility(CodeGen *g, AstNode *pa | ... | @@ -1351,14 +1356,6 @@ static TypeTableEntry *determine_peer_type_compatibility(CodeGen *g, AstNode *pa |
| 1351 | prev_type = cur_type; | 1356 | prev_type = cur_type; |
| 1352 | prev_node = cur_node; | 1357 | prev_node = cur_node; |
| 1353 | continue; | 1358 | continue; |
| 1354 | } else if (prev_type->id == TypeTableEntryIdNumLitFloat && | | |
| 1355 | cur_type->id == TypeTableEntryIdNumLitFloat) | | |
| 1356 | { | | |
| 1357 | continue; | | |
| 1358 | } else if (prev_type->id == TypeTableEntryIdNumLitInt && | | |
| 1359 | cur_type->id == TypeTableEntryIdNumLitInt) | | |
| 1360 | { | | |
| 1361 | continue; | | |
| 1362 | } else if (prev_type->id == TypeTableEntryIdNumLitInt || | 1359 | } else if (prev_type->id == TypeTableEntryIdNumLitInt || |
| 1363 | prev_type->id == TypeTableEntryIdNumLitFloat) | 1360 | prev_type->id == TypeTableEntryIdNumLitFloat) |
| 1364 | { | 1361 | { |