diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-05-08 14:12:16 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-05-08 14:12:16 +0200 |
| commit | 6443fc0a31f2949993d7cd7806391fd5d7ee97c3 (patch) | |
| tree | ec2a925c097dbb70d867560c7f30845fabeb2290 /tests | |
| parent | b3548adc1efcb143767e63d370efed1a60f724c5 (diff) | |
more work on generics and overloading
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/completions_test.odin | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin index 48000a0..9cd5a6f 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -304,6 +304,38 @@ index_package_completion :: proc(t: ^testing.T) { test.expect_completion_details(t, &source, ".", {"my_package.My_Struct: struct"}); } +@(test) +ast_generic_make_completion :: proc(t: ^testing.T) { + + source := test.Source { + main = `package test + + make :: proc{ + make_dynamic_array, + make_dynamic_array_len, + }; + + make_dynamic_array :: proc($T: typeid/[dynamic]$E, allocator := context.allocator, loc := #caller_location) -> (T, Allocator_Error) #optional_second { + } + + make_dynamic_array_len :: proc($T: typeid/[dynamic]$E, auto_cast len: int, allocator := context.allocator, loc := #caller_location) -> (T, Allocator_Error) #optional_second { + } + + My_Struct :: struct { + my_int: int, + } + + main :: proc() { + my_array := make([dynamic]My_Struct, context.allocator); + my_array[2].* + } + `, + packages = {}, + }; + + test.expect_completion_details(t, &source, ".", {"My_Struct.my_int: int"}); +} + /* SymbolUntypedValue :: struct { |