fix #820
This commit is contained in:
parent
d0f93fcacf
commit
0b30c64fd6
|
|
@ -1416,12 +1416,16 @@ namespace CodeFormatters
|
|||
sb.Append("unit");
|
||||
SetKeywordOffset("unit");
|
||||
}
|
||||
else
|
||||
else if (_unit_name.HeaderKeyword == UnitHeaderKeyword.Library)
|
||||
{
|
||||
sb.Append("library");
|
||||
SetKeywordOffset("library");
|
||||
}
|
||||
|
||||
else if (_unit_name.HeaderKeyword == UnitHeaderKeyword.Namespace)
|
||||
{
|
||||
sb.Append("namespace");
|
||||
SetKeywordOffset("namespace");
|
||||
}
|
||||
visit_node(_unit_name.idunit_name);
|
||||
//sb.AppendLine(";");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4292,7 +4292,7 @@ namespace CodeCompletion
|
|||
|
||||
}
|
||||
if (gen_args.Count > 0)
|
||||
ts = ts.GetInstance(gen_args);
|
||||
ts = ts.GetInstance(gen_args, true);
|
||||
//ts.MakeInstance();
|
||||
//ret_tn = ts.GetGenericInstance(gen_args);
|
||||
//ts.si.describe = ts.ToString();
|
||||
|
|
|
|||
|
|
@ -1728,7 +1728,7 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
|
@ -2308,7 +2308,7 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
|
@ -2396,7 +2396,7 @@ namespace CodeCompletion
|
|||
return this.ToString();
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
|
@ -2593,7 +2593,7 @@ namespace CodeCompletion
|
|||
return null;
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
return new FileScope(gen_args[0], this.topScope);
|
||||
}
|
||||
|
|
@ -2665,7 +2665,7 @@ namespace CodeCompletion
|
|||
si.description = name + " in " + declScope.si.name;
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
if (gen_args.Count > 0)
|
||||
return gen_args[0];
|
||||
|
|
@ -2766,12 +2766,12 @@ namespace CodeCompletion
|
|||
return actType.GetIndexers();
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
TypeScope original_type = actType;
|
||||
if (actType.original_type != null)
|
||||
original_type = actType.original_type;
|
||||
TypeScope ts = original_type.GetInstance(gen_args);
|
||||
TypeScope ts = original_type.GetInstance(gen_args, exact);
|
||||
ts.aliased = true;
|
||||
return ts;
|
||||
}
|
||||
|
|
@ -2895,7 +2895,7 @@ namespace CodeCompletion
|
|||
get { return actType.ElementType; }
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
|
@ -3114,7 +3114,7 @@ namespace CodeCompletion
|
|||
return this.ToString();
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
if ((elementType is UnknownScope || elementType is TemplateParameterScope) && gen_args.Count > 0)
|
||||
return new ArrayScope(gen_args[gen_args.Count-1], Rank > 1?indexes:null);
|
||||
|
|
@ -3329,7 +3329,7 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
|
@ -3511,7 +3511,7 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
|
@ -3910,7 +3910,7 @@ namespace CodeCompletion
|
|||
return ts;
|
||||
}
|
||||
|
||||
public virtual TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public virtual TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
TypeScope ts = new TypeScope(this.kind, this.topScope, this.baseScope);
|
||||
ts.original_type = this;
|
||||
|
|
@ -3919,7 +3919,7 @@ namespace CodeCompletion
|
|||
for (int i = 0; i < gen_args.Count; i++)
|
||||
{
|
||||
TypeScope gen_arg = gen_args[i];
|
||||
if (gen_arg.instances != null && gen_arg.original_type != null)
|
||||
if (gen_arg.instances != null && gen_arg.original_type != null && !exact)
|
||||
{
|
||||
if (gen_arg.original_type.generic_params != null && this.generic_params != null)
|
||||
for (int j = 0; j < gen_arg.original_type.generic_params.Count; j++)
|
||||
|
|
@ -5059,7 +5059,7 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
Type t = this.ctn;
|
||||
if (!ctn.IsGenericType)
|
||||
|
|
@ -5085,7 +5085,7 @@ namespace CodeCompletion
|
|||
sc.generic_params = new List<string>();
|
||||
sc.instances = new List<TypeScope>();
|
||||
sc.original_type = this;
|
||||
if (this.instances != null && this.instances.Count > 0)
|
||||
if (this.instances != null && this.instances.Count > 0 && !exact)
|
||||
for (int i = 0; i < this.instances.Count; i++)
|
||||
{
|
||||
if (this.instances[i] is UnknownScope || this.instances[i] is TemplateParameterScope)
|
||||
|
|
@ -7318,7 +7318,7 @@ namespace CodeCompletion
|
|||
return new List<SymScope>(0);
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args)
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
{
|
||||
if (gen_args.Count > 0)
|
||||
return gen_args[0];
|
||||
|
|
|
|||
9
TestSuite/intellisense_tests/generics8.pas
Normal file
9
TestSuite/intellisense_tests/generics8.pas
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
type
|
||||
MyType<T> = class
|
||||
Variable: T;
|
||||
end;
|
||||
|
||||
begin
|
||||
var V{@var V: MyType<Nullable<integer>>;@} := new MyType&<integer?>();
|
||||
var l{@var l: List<Nullable<integer>>;@} := new List<integer?>();
|
||||
end.
|
||||
Loading…
Reference in a new issue