From 9345e0d509c5c5e7ccc4fe510e6963fc0d3d3df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Sun, 29 May 2016 12:16:22 +0200 Subject: [PATCH] bug fix #171 --- CodeCompletion/SymTable.cs | 8 ++++++-- TestSuite/intellisense_tests/extensionmethods1.pas | 5 +++++ VisualPlugins/CompilerController/CompilerInformation.cs | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 TestSuite/intellisense_tests/extensionmethods1.pas diff --git a/CodeCompletion/SymTable.cs b/CodeCompletion/SymTable.cs index f8ee38782..490266594 100644 --- a/CodeCompletion/SymTable.cs +++ b/CodeCompletion/SymTable.cs @@ -305,6 +305,10 @@ namespace CodeCompletion if (extension_methods == null) extension_methods = new Dictionary>(); List meth_list = null; + if (ts is CompiledScope && (ts as CompiledScope).CompiledType.IsGenericType && !(ts as CompiledScope).CompiledType.IsGenericTypeDefinition) + ts = TypeTable.get_compiled_type((ts as CompiledScope).CompiledType.GetGenericTypeDefinition()); + if (ts.original_type != null) + ts = ts.original_type; if (!extension_methods.TryGetValue(ts, out meth_list)) { meth_list = new List(); @@ -347,7 +351,7 @@ namespace CodeCompletion { TypeScope tmp_ts2 = tmp_ts; if (tmp_ts is CompiledScope && (tmp_ts as CompiledScope).CompiledType.IsGenericType && !(tmp_ts as CompiledScope).CompiledType.IsGenericTypeDefinition) - tmp_ts2 = TypeTable.get_compiled_type(new SymInfo("", SymbolKind.Class, ""), (tmp_ts as CompiledScope).CompiledType.GetGenericTypeDefinition()); + tmp_ts2 = TypeTable.get_compiled_type((tmp_ts as CompiledScope).CompiledType.GetGenericTypeDefinition()); if (extension_methods.TryGetValue(tmp_ts2, out meths)) { lst.AddRange(meths); @@ -369,7 +373,7 @@ namespace CodeCompletion { TypeScope int_ts2 = int_ts; if (int_ts is CompiledScope && (int_ts as CompiledScope).CompiledType.IsGenericType && !(int_ts as CompiledScope).CompiledType.IsGenericTypeDefinition) - int_ts2 = TypeTable.get_compiled_type(new SymInfo("", SymbolKind.Class, ""), (int_ts as CompiledScope).CompiledType.GetGenericTypeDefinition()); + int_ts2 = TypeTable.get_compiled_type((int_ts as CompiledScope).CompiledType.GetGenericTypeDefinition()); if (extension_methods.TryGetValue(int_ts2, out meths)) { lst.AddRange(meths); diff --git a/TestSuite/intellisense_tests/extensionmethods1.pas b/TestSuite/intellisense_tests/extensionmethods1.pas new file mode 100644 index 000000000..bd90a1a99 --- /dev/null +++ b/TestSuite/intellisense_tests/extensionmethods1.pas @@ -0,0 +1,5 @@ +//ä +begin + var l := Seq(2,1,4); + l.OfType&().ForEach{@(расширение) procedure ForEach(Self: sequence of T; action: T->());@}(x->Print(x)); +end. \ No newline at end of file diff --git a/VisualPlugins/CompilerController/CompilerInformation.cs b/VisualPlugins/CompilerController/CompilerInformation.cs index 28338c2f7..ed740ac3a 100644 --- a/VisualPlugins/CompilerController/CompilerInformation.cs +++ b/VisualPlugins/CompilerController/CompilerInformation.cs @@ -232,6 +232,7 @@ namespace VisualPascalABCPlugins void Button2Click(object sender, EventArgs e) { CodeCompletion.CodeCompletionTester.Test(); + CodeCompletion.CodeCompletionTester.TestIntellisense(Path.Combine(@"c:\Work\Miks\_PABCNETGitHub\TestSuite", "intellisense_tests")); MessageBox.Show("Done"); }