aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-06-30 18:30:57 +0200
committerDanielGavin <danielgavin5@hotmail.com>2024-06-30 18:30:57 +0200
commit0e7d21ee627cf152f8c6e80db20f52a94535ad5e (patch)
tree99dacb17d6c08a3d5d2844a2d828ca89a9d2590f
parent97957d3e3670988e755e77c0cb18a7b0368de6bf (diff)
Fix issues with generics
-rw-r--r--src/server/analysis.odin5
-rw-r--r--tests/completions_test.odin26
2 files changed, 31 insertions, 0 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index f111c5d..8956c70 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -629,6 +629,11 @@ resolve_function_overload :: proc(
call_expr := ast_context.call
+ //If there is nothing to resolve from, we actually want to get the invalid overloaded results through setting overloading to false
+ if call_expr == nil || len(call_expr.args) == 0 {
+ ast_context.overloading = false
+ }
+
candidates := make([dynamic]Symbol, context.temp_allocator)
for arg_expr in group.args {
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index 403ae51..76ed98a 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -266,6 +266,32 @@ ast_completion_identifier_proc_group :: proc(t: ^testing.T) {
}
@(test)
+ast_completion_identifier_proc_group_2 :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ raw_data_slice :: proc(v: $T/[]$E) -> [^]E {
+ }
+
+ zzcool :: proc {
+ raw_data_slice,
+ }
+
+ main :: proc() {
+ zzco{*}
+ }
+
+ `,
+ }
+
+ test.expect_completion_details(
+ t,
+ &source,
+ "",
+ {"test.zzcool: proc(v: $T/[]$E) -> [^]E"},
+ )
+}
+
+@(test)
ast_completion_in_comp_lit_type :: proc(t: ^testing.T) {
source := test.Source {
main = `package test