| author | |
| committer | |
| log | ee22e872967947d2f6e64cba888bf7bf56e4d332 |
| tree | 02935f88bf83494ea3a4da056206e64ed9f2cfc3 |
| parent | 1d4c66b56beb7b2da6bafbab6871691641c8da0b |
See #222 files changed, 7 insertions(+), 2 deletions(-)
src/analyze.cpp+2-2| ... | ... | @@ -4667,8 +4667,8 @@ static TypeTableEntry *analyze_generic_fn_call(CodeGen *g, ImportTableEntry *imp |
| 4667 | 4667 | |
| 4668 | 4668 | AstNode **generic_param_type_node = &generic_param_decl_node->data.param_decl.type; |
| 4669 | 4669 | |
| 4670 | TypeTableEntry *expected_param_type = analyze_expression(g, decl_node->owner, | |
| 4671 | decl_node->owner->block_context, nullptr, *generic_param_type_node); | |
| 4670 | TypeTableEntry *expected_param_type = analyze_type_expr(g, decl_node->owner, | |
| 4671 | decl_node->owner->block_context, *generic_param_type_node); | |
| 4672 | 4672 | if (expected_param_type->id == TypeTableEntryIdInvalid) { |
| 4673 | 4673 | return expected_param_type; |
| 4674 | 4674 | } |
test/self_hosted.zig+5| ... | ... | @@ -516,12 +516,17 @@ three)"; |
| 516 | 516 | fn simple_generic_fn() { |
| 517 | 517 | assert(max(i32)(3, -1) == 3); |
| 518 | 518 | assert(max(f32)(0.123, 0.456) == 0.456); |
| 519 | assert(add(2)(3) == 5); | |
| 519 | 520 | } |
| 520 | 521 | |
| 521 | 522 | fn max(T: type)(a: T, b: T) -> T { |
| 522 | 523 | return if (a > b) a else b; |
| 523 | 524 | } |
| 524 | 525 | |
| 526 | fn add(a: i32)(b: i32) -> i32 { | |
| 527 | return a + b; | |
| 528 | } | |
| 529 | ||
| 525 | 530 | |
| 526 | 531 | #attribute("test") |
| 527 | 532 | fn constant_equal_function_pointers() { |