This commit is contained in:
parent
a18fd381b7
commit
af1b9b85f4
14
TestSuite/errors/err0399.pas
Normal file
14
TestSuite/errors/err0399.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
type
|
||||
t1 = class
|
||||
static function operator implicit<T>(o: T): t1;
|
||||
where T: record;
|
||||
begin end;
|
||||
end;
|
||||
|
||||
t2 = class end;
|
||||
|
||||
procedure p1(q: t1) := exit;
|
||||
|
||||
begin
|
||||
p1(new t2);//Здесь теперь правильная ошибка: Нельзя преобразовать тип t2 к t1
|
||||
end.
|
||||
19
TestSuite/implicitexplicit10.pas
Normal file
19
TestSuite/implicitexplicit10.pas
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
var i: integer;
|
||||
type
|
||||
t1 = class
|
||||
static function operator implicit<T>(o: T): t1;
|
||||
where T: record;
|
||||
begin
|
||||
i := 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
t2 = class(t1) end;
|
||||
|
||||
procedure p1(q: t1) := exit;
|
||||
|
||||
begin
|
||||
//Ошибка: Невозможно инстанцировать, так как тип t2 не является размерным
|
||||
p1(new t2);
|
||||
assert(i = 0);
|
||||
end.
|
||||
|
|
@ -2331,7 +2331,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
if (ctn.IsPointer)
|
||||
continue;
|
||||
fn = fn.get_instance(new List<type_node>(new type_node[] { ctn }), true, null);
|
||||
fn = fn.get_instance(new List<type_node>(new type_node[] { ctn }), false, null);
|
||||
}
|
||||
}
|
||||
return fn;
|
||||
|
|
@ -2373,7 +2373,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
ctn = (ctn as ref_type_node).pointed_type;
|
||||
if (ctn.IsPointer)
|
||||
continue;
|
||||
fn = fn.get_instance(new List<type_node>(new type_node[] { ctn }), true, null);
|
||||
fn = fn.get_instance(new List<type_node>(new type_node[] { ctn }), false, null);
|
||||
}
|
||||
}
|
||||
return fn;
|
||||
|
|
|
|||
Loading…
Reference in a new issue