diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-30 23:48:18 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-30 23:48:18 +0100 |
| commit | af15c040ce045df81567402cc4ce80412dd36b8f (patch) | |
| tree | 4d3411bfc67c33eb7a7358e9c744f60f5b0f3ddc | |
| parent | 7b2281e5fd7efe6959d9d6cfe2758b1fbaadc247 (diff) | |
Fix signatures
| -rw-r--r-- | src/common/ast.odin | 7 | ||||
| -rw-r--r-- | tests/signatures_test.odin | 22 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/common/ast.odin b/src/common/ast.odin index 62ae7e9..ff6f7e2 100644 --- a/src/common/ast.odin +++ b/src/common/ast.odin @@ -771,7 +771,12 @@ build_string_node :: proc(node: ^ast.Node, builder: ^strings.Builder) { case Call_Expr: build_string(n.expr, builder); strings.write_string(builder, "("); - build_string(n.args, builder); + for arg, i in n.args { + build_string(arg, builder); + if len(n.args) - 1 != i { + strings.write_string(builder, ", "); + } + } strings.write_string(builder, ")"); case Selector_Expr: build_string(n.expr, builder); diff --git a/tests/signatures_test.odin b/tests/signatures_test.odin index 0e0af1f..9363962 100644 --- a/tests/signatures_test.odin +++ b/tests/signatures_test.odin @@ -486,6 +486,28 @@ shared_value_decl_type_signature :: proc(t: ^testing.T) { test.expect_signature_labels(t, &source, {"test.my_function: proc(a: int, b: int)"}); } +@(test) +proc_with_struct_poly :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + U :: struct(N: int, E: typetid) { + t: [N]E, + } + + uf :: proc(u: U($T, $E)) { + } + + main :: proc() { + uf(*) + } + `, + packages = {}, + }; + + test.expect_signature_labels(t, &source, {"test.uf: proc(u: U($T, $E))"}); +} + + /* @(test) signature_function_inside_when :: proc(t: ^testing.T) { |