This commit is contained in:
parent
bc73af899e
commit
68a1a4f3c6
|
|
@ -2272,7 +2272,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
|
||||
TypeAttributes ta = (not_exist) ? ConvertAttributes(value) : TypeAttributes.NotPublic;
|
||||
|
||||
if (value.base_type is ICompiledTypeNode && (value.base_type as ICompiledTypeNode).compiled_type == TypeFactory.EnumType)
|
||||
if (value.base_type is ICompiledTypeNode && (value.base_type as ICompiledTypeNode).compiled_type == TypeFactory.EnumType && gtpb == null)
|
||||
{
|
||||
ta = TypeAttributes.Public;
|
||||
if (value.type_access_level == type_access_level.tal_internal)
|
||||
|
|
|
|||
11
TestSuite/where15.pas
Normal file
11
TestSuite/where15.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
uses System;
|
||||
|
||||
function ToEnum<T>(self: string): T; extensionmethod; where T: System.Enum;
|
||||
begin
|
||||
Result := T(Enum.Parse(typeof(T), self));
|
||||
end;
|
||||
|
||||
begin
|
||||
var color := 'Black'.ToEnum&<ConsoleColor>();
|
||||
assert(color = ConsoleColor.Black);
|
||||
end.
|
||||
|
|
@ -12743,10 +12743,10 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
AddError(get_location(specificators[i]), "OBJECT_CAN_NOT_BE_USED_AS_PARENT_SPECIFICATOR");
|
||||
}
|
||||
if (spec_type == SystemLibrary.SystemLibrary.enum_base_type)
|
||||
/*if (spec_type == SystemLibrary.SystemLibrary.enum_base_type)
|
||||
{
|
||||
AddError(get_location(specificators[i]), "ENUM_CAN_NOT_BE_USED_AS_PARENT_SPECIFICATOR");
|
||||
}
|
||||
}*/
|
||||
if (spec_type.IsStatic)
|
||||
AddError(get_location(specificators[i]), "STATIC_CLASS_CAN_NOT_BE_USED_AS_PARENT_SPECIFICATOR");
|
||||
check_cycle_inheritance(param, spec_type);
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
return new SimpleSemanticError(null, "PARAMETER_{0}_MUST_BE_DERIVED_FROM_{1}", tn.PrintableName, base_type.name);
|
||||
}
|
||||
}
|
||||
if (gpe.base_class != null && gpe.base_class != SystemLibrary.SystemLibrary.object_type && tn.is_value && !gpe.base_class.is_value && gpe.base_class != SystemLibrary.SystemLibrary.value_type)
|
||||
if (gpe.base_class != null && gpe.base_class != SystemLibrary.SystemLibrary.object_type && tn.is_value && !gpe.base_class.is_value && gpe.base_class != SystemLibrary.SystemLibrary.value_type && gpe.base_class != SystemLibrary.SystemLibrary.enum_base_type)
|
||||
{
|
||||
return new SimpleSemanticError(null, "PARAMETER_{0}_MUST_BE_REFERENCE_TYPE", tn.PrintableName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue