bug fix #143
This commit is contained in:
parent
355452bccf
commit
5eade0517b
|
|
@ -4771,6 +4771,8 @@ namespace CodeCompletion
|
|||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
{
|
||||
Type t = this.ctn;
|
||||
if (!ctn.IsGenericType)
|
||||
return this;
|
||||
if (!ctn.IsGenericTypeDefinition)
|
||||
t = PascalABCCompiler.NetHelper.NetHelper.FindType(this.ctn.Namespace + "." + this.ctn.Name);
|
||||
else if (this.instances != null && this.instances.Count > 0)
|
||||
|
|
|
|||
|
|
@ -1634,7 +1634,22 @@ namespace PascalABCCompiler.Parsers
|
|||
Type[] tt = scope.CompiledMethod.GetGenericArguments();
|
||||
int gen_ind = 0;
|
||||
if (!scope.IsExtension)
|
||||
{
|
||||
sb.Append(GetShortTypeName(scope.CompiledMethod.DeclaringType));
|
||||
int ind = 0;
|
||||
foreach (Type gen_arg in scope.CompiledMethod.DeclaringType.GetGenericArguments())
|
||||
{
|
||||
if (gen_arg.IsGenericParameter)
|
||||
{
|
||||
if (generic_param_args == null)
|
||||
generic_param_args = new Dictionary<string, string>();
|
||||
if (scope.GenericArgs.Count > ind)
|
||||
generic_param_args.Add(gen_arg.Name, scope.GenericArgs[ind]);
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
gen_ind = 1;
|
||||
|
|
@ -1648,6 +1663,8 @@ namespace PascalABCCompiler.Parsers
|
|||
{
|
||||
if (!class_generic_table.ContainsKey(class_generic_args[i].Name))
|
||||
class_generic_table.Add(class_generic_args[i].Name, j);
|
||||
if (scope.GenericArgs.Count > j)
|
||||
generic_param_args.Add(class_generic_args[i].Name, scope.GenericArgs[j]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,9 @@
|
|||
begin
|
||||
var l := Seq(2,1,4);
|
||||
l.OfType&<integer>().ForEach{@(расширение) procedure ForEach<T>(Self: sequence of T; action: T->());@}(x->Print(x));
|
||||
var l1 := new List<integer>;
|
||||
var seq1{@var seq1: sequence of integer;@} := l1.Where{@(расширение) function IEnumerable<>.Where<>(predicate: integer->boolean): sequence of integer;@}(i->true);
|
||||
var l2 := l1.ConvertAll&{@function List<>.ConvertAll<TOutput>(converter: Converter<integer,TOutput>): List<TOutput>;@}<real>();
|
||||
var seq2{@var seq2: sequence of integer;@} := l1.Skip{@(расширение) function IEnumerable<>.Skip<>(count: integer): sequence of integer;@}(3);
|
||||
l1.OrderBy(i->i).Skip{@(расширение) function IEnumerable<>.Skip<>(count: integer): sequence of integer;@}(3);
|
||||
end.
|
||||
Loading…
Reference in a new issue