summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-10-04 08:10:38 -0400
committerGitHub <noreply@github.com>2025-10-04 08:10:38 -0400
commit55b3900c8fa1e439ea31aac984bedbabb8dcf5b0 (patch)
tree177dfe6d6ecc15816444766cf2fca27b9e4bdc1e
parentb85caeb82b86af897113eff551d37616d4e8e440 (diff)
parente0dbda3ab7082551c5b1ccd06bcd76f1d3f437ba (diff)
Merge pull request #1077 from BradLewis/fix/generic-proc-inlining-hover
Add proc inlining information for generic procs
-rw-r--r--src/server/analysis.odin3
-rw-r--r--src/server/generics.odin4
-rw-r--r--tests/hover_test.odin16
3 files changed, 21 insertions, 2 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index abddab6..1ee5ad6 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -2482,7 +2482,8 @@ resolve_symbol_return :: proc(ast_context: ^AstContext, symbol: Symbol, ok := tr
}
case SymbolProcedureValue:
if v.generic {
- if resolved_symbol, ok := resolve_generic_function(ast_context, v.arg_types, v.return_types); ok {
+ if resolved_symbol, ok := resolve_generic_function(ast_context, v.arg_types, v.return_types, v.inlining);
+ ok {
return resolved_symbol, ok
} else {
return symbol, true
diff --git a/src/server/generics.odin b/src/server/generics.odin
index e8abdaf..d57f4d5 100644
--- a/src/server/generics.odin
+++ b/src/server/generics.odin
@@ -502,7 +502,7 @@ resolve_generic_function_ast :: proc(ast_context: ^AstContext, proc_lit: ast.Pro
results = proc_lit.type.results.list
}
- return resolve_generic_function_symbol(ast_context, params, results)
+ return resolve_generic_function_symbol(ast_context, params, results, proc_lit.inlining)
}
@@ -510,6 +510,7 @@ resolve_generic_function_symbol :: proc(
ast_context: ^AstContext,
params: []^ast.Field,
results: []^ast.Field,
+ inlining: ast.Proc_Inlining,
) -> (
Symbol,
bool,
@@ -686,6 +687,7 @@ resolve_generic_function_symbol :: proc(
arg_types = argument_types[:],
orig_arg_types = params[:],
orig_return_types = results[:],
+ inlining = inlining,
}
return symbol, true
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index f2ff18c..796787c 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -5135,6 +5135,22 @@ ast_hover_parapoly_proc_slice_param_return :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.it: test.Iter(string)")
}
+
+@(test)
+ast_hover_generic_proc_with_inlining :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Bar :: struct{}
+
+ foo :: #force_inline proc(data: $T) {}
+
+ main :: proc() {
+ f{*}oo(Bar{})
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.foo :: #force_inline proc(data: $T)")
+}
/*
Waiting for odin fix