fix #2190
This commit is contained in:
parent
4d0adaef12
commit
43cf831ba3
14
TestSuite/where11.pas
Normal file
14
TestSuite/where11.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
type
|
||||
|
||||
t1<T> = class where T: t1<T>;
|
||||
|
||||
function p1: T;
|
||||
begin
|
||||
var a: t1<T>;
|
||||
var b := a as T;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
||||
|
|
@ -3085,7 +3085,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
else
|
||||
{
|
||||
if (tp.is_generic_parameter && !tp.is_class && !(tp.base_type != null && tp.base_type.is_class))
|
||||
if (tp.is_generic_parameter && !tp.is_class && !(tp.base_type != null && tp.base_type.is_class) && !(tp.base_type != null && tp.base_type.original_generic != null && tp.base_type.original_generic.is_class))
|
||||
AddError(get_location(node.type_def), "OPERATOR_AS_CAN_NOT_BE_USED_WITH_GENERIC_PARAMETER_{0}_WITHOUT_CLASS_CONSTRAINT", tp.name);
|
||||
if (tp.is_value_type)
|
||||
AddError(get_location(node.type_def), "OPERATOR_AS_MUST_BE_USED_WITCH_A_REFERENCE_TYPE_VALUETYPE{0}", tp.PrintableName);
|
||||
|
|
|
|||
Loading…
Reference in a new issue