This commit is contained in:
Sun Serega 2022-09-27 18:29:49 +03:00
parent aea94d1df4
commit ae4ef7034f
3 changed files with 5 additions and 4 deletions

View file

@ -1,4 +1,5 @@
type
//!Невозможно инстанцировать, так как тип T не наследован от List<integer>
type
t1<T> = class
where T: List<integer>;

View file

@ -3808,7 +3808,7 @@ namespace PascalABCCompiler.TreeConverter
location loc = get_location(syntax_tn);
var tn = (type_node)ret.visit(syntax_tn);
if (tn.is_generic_type_definition) need_recheck_where.Add(syntax_tn);
if (tn.is_generic_type_definition || tn.is_generic_type_instance) need_recheck_where.Add(syntax_tn);
if ((tn.original_generic??tn).ForwardDeclarationOnly)
AddError(loc, "FORWARD_DECLARATION_{0}_AS_BASE_TYPE", tn.PrintableName);

View file

@ -161,7 +161,7 @@ namespace PascalABCCompiler.TreeRealization
// tn - не generic параметр - закомментировал
if (base_type != tn && !type_table.is_derived(base_type, tn) /*&& !tn.is_generic_parameter*/)
{
return new SimpleSemanticError(null, "PARAMETER_{0}_MUST_BE_DERIVED_FROM_{1}", tn.PrintableName, base_type.name);
return new SimpleSemanticError(null, "PARAMETER_{0}_MUST_BE_DERIVED_FROM_{1}", tn.PrintableName, base_type.PrintableName);
}
}
if (gpe.is_class && !tn.is_class)
@ -179,7 +179,7 @@ namespace PascalABCCompiler.TreeRealization
(tn.ImplementingInterfaces == null ||
!type_table.is_derived(di, tn)))
{
return new SimpleSemanticError(null, "PARAMETER_{0}_MUST_IMPLEMENT_INTERFACE_{1}", tn.PrintableName, di.name);
return new SimpleSemanticError(null, "PARAMETER_{0}_MUST_IMPLEMENT_INTERFACE_{1}", tn.PrintableName, di.PrintableName);
}
}
if (tn.IsStatic)