fix #1980
This commit is contained in:
parent
c95b0aa94d
commit
4aaa4c2a3b
20
TestSuite/generics27.pas
Normal file
20
TestSuite/generics27.pas
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
type
|
||||||
|
t1 = class end;
|
||||||
|
|
||||||
|
procedure p2<T>(a: T); where T:class;
|
||||||
|
begin
|
||||||
|
assert(a = nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure p1<T>; where T: t1;
|
||||||
|
begin
|
||||||
|
var a: T;
|
||||||
|
var b: t1;
|
||||||
|
a := b as T;
|
||||||
|
p2&<t1>(b);
|
||||||
|
assert(a = nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
p1&<t1>;
|
||||||
|
end.
|
||||||
|
|
@ -12361,6 +12361,8 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
type_node spec_type = ret.visit(ntr);
|
type_node spec_type = ret.visit(ntr);
|
||||||
if (spec_type is ref_type_node || spec_type == SystemLibrary.SystemLibrary.void_type || spec_type == SystemLibrary.SystemLibrary.pointer_type)
|
if (spec_type is ref_type_node || spec_type == SystemLibrary.SystemLibrary.void_type || spec_type == SystemLibrary.SystemLibrary.pointer_type)
|
||||||
AddError(new SimpleSemanticError(get_location(specificators[i]), "INAVLID_TYPE"));
|
AddError(new SimpleSemanticError(get_location(specificators[i]), "INAVLID_TYPE"));
|
||||||
|
if (spec_type.is_class)
|
||||||
|
param.is_class = true;
|
||||||
if (spec_type.IsInterface)
|
if (spec_type.IsInterface)
|
||||||
{
|
{
|
||||||
if (used_interfs[spec_type] != null)
|
if (used_interfs[spec_type] != null)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue