diff --git a/CodeCompletion/DomSyntaxTreeVisitor.cs b/CodeCompletion/DomSyntaxTreeVisitor.cs index 866296664..a08846617 100644 --- a/CodeCompletion/DomSyntaxTreeVisitor.cs +++ b/CodeCompletion/DomSyntaxTreeVisitor.cs @@ -4597,7 +4597,7 @@ namespace CodeCompletion public override void visit(ident_with_templateparams node) { node.name.visit(this); - if (search_all && returned_scopes.Count > 0 && returned_scopes[0] is ProcScope) + if ((search_all || returned_scope == null) && returned_scopes.Count > 0 && returned_scopes[0] is ProcScope) { ProcScope ps = returned_scopes[0] as ProcScope; List template_params = new List(); diff --git a/TestSuite/intellisense_tests/generics4.pas b/TestSuite/intellisense_tests/generics4.pas new file mode 100644 index 000000000..48f08d235 --- /dev/null +++ b/TestSuite/intellisense_tests/generics4.pas @@ -0,0 +1,9 @@ +function f1(a: T) := a; + +function f2(): T;begin end; + +begin + var a1{var a1: byte;} := f1&(word(0)); + var a2{var a2: byte;} := f2&(); + var a3{var a3: word;} := f1(word(0)); +end. \ No newline at end of file