diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2022-07-28 12:44:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-28 12:44:20 +0200 |
| commit | 6c824e20abcd41ff02f3f6f296e6170cd77b8ee5 (patch) | |
| tree | 8d76f2cee15e1a29a99fd748755e84df17acf9fd | |
| parent | cdbc1bfd870ffc4d317b48ad49019fc9f6edb74f (diff) | |
| parent | 75b817eb4bbb69e718cc5bf76a13708d9d3eb306 (diff) | |
Merge pull request #124 from nico-bb/master
Fixed resolving polymorphic procedure signature
| -rw-r--r-- | src/server/analysis.odin | 2 | ||||
| -rw-r--r-- | tests/completions_test.odin | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index f130935..e1cffb5 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -149,6 +149,8 @@ get_poly_node_to_expr :: proc(node: ^ast.Node) -> ^ast.Expr { #partial switch v in node.derived { case ^Ident: return cast(^Expr)node + case ^Comp_Lit: + return v.type case: log.warnf("Unhandled poly to node kind %v", v) } diff --git a/tests/completions_test.odin b/tests/completions_test.odin index f9e93da..5fda923 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -1349,6 +1349,26 @@ ast_new_completion :: proc(t: ^testing.T) { } @(test) +ast_new_clone_completion :: proc(t: ^testing.T) { + source := test.Source { + main = `package main + new_clone :: proc(data: $T) -> (^T, Allocator_Error) #optional_second { + } + + Foo :: struct {} + + main :: proc() { + adzz := new_clone(Foo{}); + adzz* + } + + `, + }; + + test.expect_completion_details(t, &source, "", {"test.adzz: Foo"}); +} + +@(test) ast_rawtr_cast_completion :: proc(t: ^testing.T) { source := test.Source { main = `package main |