aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/analysis.odin2
-rw-r--r--tests/completions_test.odin20
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