aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-10-05 21:49:33 +0200
committerDanielGavin <danielgavin5@hotmail.com>2024-10-05 21:49:33 +0200
commitca2b55c02d91f3df76c748686a72a42a62a7991a (patch)
tree2c9aec77820c48d0822288f8f0efb937b48cea60 /tests
parent90c90ae5dd0619f246c2379f48a4f0a7b5f5e0b7 (diff)
function overload now handles shared types in function. Hover should also show the function that was picked based on the arguments.
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin23
-rw-r--r--tests/hover_test.odin29
2 files changed, 50 insertions, 2 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index e9912a4..2379ecb 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -283,6 +283,29 @@ ast_completion_identifier_proc_group_2 :: proc(t: ^testing.T) {
}
@(test)
+ast_completion_untyped_proc_group :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ add_num :: proc(a, b: int) -> int {return a + b}
+ add_vec :: proc(a, b: [2]f32) -> [2]f32 {return a + b}
+
+ add :: proc {
+ add_num,
+ add_vec,
+ }
+
+ main :: proc() {
+ foozz := add(2, 10)
+ fooz{*}
+ }
+ `,
+ }
+
+ test.expect_completion_details(t, &source, "", {"test.foozz: int"})
+}
+
+
+@(test)
ast_completion_in_comp_lit_type :: proc(t: ^testing.T) {
source := test.Source {
main = `package test
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 0afe930..0c3b750 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -330,8 +330,34 @@ ast_hover_package_with_value_decl_same_name :: proc(t: ^testing.T) {
test.expect_hover(t, &source, "my_package.my_package: proc() -> int")
}
+
+@(test)
+ast_hover_proc_group :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ add_num :: proc(a, b: int) -> int {return a + b}
+
+ add_vec :: proc(a, b: [2]f32) -> [2]f32 {return a + b}
+
+ add :: proc {
+ add_num,
+ add_vec,
+ }
+ main :: proc() {
+ foo := ad{*}d(2, 2)
+ }
+
+ `,
+ packages = {},
+ }
+
+ test.expect_hover(t, &source, "test.add: proc(a, b: int) -> int")
+}
+
+
/*
-Issue in `core:odin/parser` it sets the wrong column and end offset for line 2.
+
+Waiting for odin fix
@(test)
ast_hover_consecutive_non_mutable :: proc(t: ^testing.T) {
@@ -347,7 +373,6 @@ a :: int
}
*/
-
/*
TODO: Allow for testing multiple files
*/