diff --git a/CodeCompletion/ExpressionVisitor.cs b/CodeCompletion/ExpressionVisitor.cs index 32bbe9b33..e6e200f4a 100644 --- a/CodeCompletion/ExpressionVisitor.cs +++ b/CodeCompletion/ExpressionVisitor.cs @@ -817,7 +817,7 @@ namespace CodeCompletion returned_scope = new ElementScope(ts); } - else if ((returned_scope != null && returned_scope is ElementScope && (returned_scope as ElementScope).sc is CompiledScope) && _dot_node.left is method_call) + else if ((returned_scope != null && returned_scope is ElementScope && (returned_scope as ElementScope).sc is CompiledScope && ((returned_scope as ElementScope).sc as CompiledScope).IsDelegate) && _dot_node.left is method_call) { ProcScope invoke_meth = ((returned_scope as ElementScope).sc as CompiledScope).FindNameOnlyInThisType("Invoke") as ProcScope; if (invoke_meth != null) diff --git a/TestSuite/intellisense_tests/invoke.pas b/TestSuite/intellisense_tests/invoke.pas new file mode 100644 index 000000000..82ae4571d --- /dev/null +++ b/TestSuite/intellisense_tests/invoke.pas @@ -0,0 +1,4 @@ +begin + var t := typeof(object); + var o := t.GetConstructor(System.Type.EmptyTypes).Invoke{@function ConstructorInfo.Invoke(parameters: array of Object): System.Object;@}(new object[0]); +end. \ No newline at end of file