This commit is contained in:
Ivan Bondarev 2022-10-23 14:31:48 +02:00
parent ea284eeac1
commit 0374273d38
2 changed files with 31 additions and 0 deletions

View file

@ -5445,6 +5445,10 @@ namespace CodeCompletion
this.ctn = ctn;
this.si = si;
this.instances = new List<TypeScope>();
if (ctn == null)
{
}
if (ctn.BaseType != null)
baseScope = TypeTable.get_compiled_type(ctn.BaseType);
Type t = ctn.GetElementType();
@ -5681,7 +5685,13 @@ namespace CodeCompletion
if (!ctn.IsGenericType)
return this;
if (!ctn.IsGenericTypeDefinition)
{
t = PascalABCCompiler.NetHelper.NetHelper.FindType(this.ctn.Namespace + "." + this.ctn.Name);
if (t == null && this.instances != null && this.instances.Count > 0 && ctn.DeclaringType != null && this.ctn.DeclaringType.IsGenericTypeDefinition)
{
t = PascalABCCompiler.NetHelper.NetHelper.FindType(this.ctn.Namespace + "." + this.ctn.DeclaringType.Name.Substring(0, this.ctn.DeclaringType.Name.IndexOf('`')) + "`" + this.instances.Count + "+" + ctn.Name);
}
}
else if (this.instances != null && this.instances.Count > 0)
{
if (this.instances.Count != ctn.GetGenericArguments().Length)
@ -5690,6 +5700,7 @@ namespace CodeCompletion
if (t2 != null)
t = t2;
}
}
else if (gen_args.Count != ctn.GetGenericArguments().Length)
{

View file

@ -0,0 +1,20 @@
type
// Обязательно шаблонный класс
t1<T> = class
key_lookup: Dictionary<T, word>;
// Обязательно возвращать вложенный тип (тут "Dictionary.KeyCollection")
// Если возвращать "sequence of T" - не воспроизводится
function GetAllKeys := key_lookup.Keys;
end;
// Обязательно наследовать от t1
t2 = class(t1<byte>)
function f1{@function t2.f1(): integer;@} := 5;
end;
begin
var o: t2;
end.