bug fix #1847
This commit is contained in:
parent
03d0f5486b
commit
222f3d981f
|
|
@ -47,6 +47,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
public static Type GCHandleType = typeof(GCHandle);
|
||||
public static Type MarshalType = typeof(Marshal);
|
||||
public static Type TypeType = typeof(Type);
|
||||
public static Type ValueType = typeof(ValueType);
|
||||
public static Type IEnumerableType = typeof(System.Collections.IEnumerable);
|
||||
public static Type IEnumeratorType = typeof(System.Collections.IEnumerator);
|
||||
public static Type IEnumerableGenericType = typeof(System.Collections.Generic.IEnumerable<>);
|
||||
|
|
@ -110,6 +111,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
sizes[UInt64Type] = sizeof(UInt64);
|
||||
sizes[SingleType] = sizeof(Single);
|
||||
sizes[DoubleType] = sizeof(Double);
|
||||
//sizes[UIntPtr] = sizeof(UIntPtr);
|
||||
|
||||
//types[TypeType] = TypeType;
|
||||
ArrayCopyMethod = typeof(Array).GetMethod("Copy", new Type[3] { typeof(Array), typeof(Array), typeof(int) });
|
||||
|
|
|
|||
|
|
@ -1132,7 +1132,6 @@ namespace PascalABCCompiler.NETGenerator
|
|||
if (ctn != null)
|
||||
throw new PascalABCCompiler.Errors.CommonCompilerError(ex.Message, ctn.Location.document.file_name, ctn.Location.begin_line_num, ctn.Location.begin_column_num);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < enums.Count; i++)
|
||||
|
|
@ -1325,7 +1324,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
private void AddTypeWithoutConvert(ICommonTypeNode t)
|
||||
{
|
||||
if (helper.GetTypeReference(t) != null) return;
|
||||
TypeBuilder tb = mb.DefineType(BuildTypeName(t.name), ConvertAttributes(t), null, new Type[0]);
|
||||
TypeBuilder tb = mb.DefineType(BuildTypeName(t.name), ConvertAttributes(t), t.is_value_type?TypeFactory.ValueType:null, new Type[0]);
|
||||
helper.AddType(t, tb);
|
||||
//(ssyy) обрабатываем generics
|
||||
if (t.is_generic_type_definition)
|
||||
|
|
@ -6660,6 +6659,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
|
||||
if (value.is_final)
|
||||
{
|
||||
|
||||
attrs |= MethodAttributes.Virtual | MethodAttributes.Final;
|
||||
}
|
||||
|
||||
|
|
|
|||
13
TestSuite/generics28.pas
Normal file
13
TestSuite/generics28.pas
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
type
|
||||
SomeType = record(IComparable<SomeType>)
|
||||
public
|
||||
function CompareTo(other: SomeType): integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
var obj := new SomeType();
|
||||
assert(obj.CompareTo(obj) = 2);
|
||||
end.
|
||||
Loading…
Reference in a new issue