diff --git a/CodeCompletion/DomSyntaxTreeVisitor.cs b/CodeCompletion/DomSyntaxTreeVisitor.cs index 030d8e6d9..bc3742967 100644 --- a/CodeCompletion/DomSyntaxTreeVisitor.cs +++ b/CodeCompletion/DomSyntaxTreeVisitor.cs @@ -4881,11 +4881,10 @@ namespace CodeCompletion } public override void visit(ident_with_templateparams node) { + bool tmp_search_all = search_all; node.name.visit(this); - if ((search_all || returned_scope == null) && returned_scopes.Count > 0) + if ((tmp_search_all || returned_scope == null) && returned_scopes.Count > 0) { - ProcScope ps = returned_scopes[0] as ProcScope; - TypeScope ts = returned_scopes[0] as TypeScope; List template_params = new List(); foreach (type_definition td in node.template_params.params_list) { @@ -4897,10 +4896,17 @@ namespace CodeCompletion return; } } - if (ps != null) - returned_scopes[0] = ps.GetInstance(template_params); - else - returned_scopes[0] = ts.GetInstance(template_params); + for (int i = 0; i < returned_scopes.Count; i++) + { + ProcScope ps = returned_scopes[i] as ProcScope; + TypeScope ts = returned_scopes[i] as TypeScope; + + if (ps != null) + returned_scopes[i] = ps.GetInstance(template_params); + else + returned_scopes[i] = ts.GetInstance(template_params); + } + } else if (returned_scope is ProcScope) { diff --git a/NETGenerator/NETGenerator.cs b/NETGenerator/NETGenerator.cs index e50552d75..a6847b398 100644 --- a/NETGenerator/NETGenerator.cs +++ b/NETGenerator/NETGenerator.cs @@ -6853,9 +6853,9 @@ namespace PascalABCCompiler.NETGenerator il.EmitCall(OpCodes.Call, mi, null); if (tmp_dot) { - if (mi.ReturnType.IsValueType && !NETGeneratorTools.IsPointer(mi.ReturnType)) + if (value.type.is_value_type && !NETGeneratorTools.IsPointer(mi.ReturnType)) { - LocalBuilder lb = il.DeclareLocal(mi.ReturnType); + LocalBuilder lb = il.DeclareLocal(helper.GetTypeReference(value.type).tp); il.Emit(OpCodes.Stloc, lb); il.Emit(OpCodes.Ldloca, lb); } diff --git a/TestSuite/generics20.pas b/TestSuite/generics20.pas index 8283b295a..bd416fd40 100644 --- a/TestSuite/generics20.pas +++ b/TestSuite/generics20.pas @@ -1,14 +1,14 @@ function Deconstruct(d: Dictionary): (K, V); begin - //var kk := d.First.Key; - //var vv := d.First.Value; - //Result := (kk, vv); + var kk := d.First.Key; + var vv := d.First.Value; + Result := (kk, vv); end; begin var d := new Dictionary; - //d[1] := 2; - //var t := Deconstruct(d); - //assert(t.Item1 = 1); - //assert(t.Item2 = 2); + d[1] := 2; + var t := Deconstruct(d); + assert(t.Item1 = 1); + assert(t.Item2 = 2); end. \ No newline at end of file