bug fix #149
This commit is contained in:
parent
cd411396bf
commit
e4f4621f61
|
|
@ -229,16 +229,22 @@ namespace PascalABCCompiler.NETGenerator
|
|||
{
|
||||
case TypeCode.Boolean:
|
||||
case TypeCode.Byte:
|
||||
il.Emit(OpCodes.Ldind_U1);
|
||||
break;
|
||||
case TypeCode.SByte:
|
||||
il.Emit(OpCodes.Ldind_I1);
|
||||
break;
|
||||
case TypeCode.Char:
|
||||
case TypeCode.Int16:
|
||||
case TypeCode.UInt16:
|
||||
il.Emit(OpCodes.Ldind_U2);
|
||||
break;
|
||||
case TypeCode.Int16:
|
||||
il.Emit(OpCodes.Ldind_I2);
|
||||
break;
|
||||
case TypeCode.Int32:
|
||||
case TypeCode.UInt32:
|
||||
il.Emit(OpCodes.Ldind_U4);
|
||||
break;
|
||||
case TypeCode.Int32:
|
||||
il.Emit(OpCodes.Ldind_I4);
|
||||
break;
|
||||
case TypeCode.Int64:
|
||||
|
|
|
|||
|
|
@ -1632,10 +1632,12 @@ namespace PascalABCCompiler.Parsers
|
|||
Dictionary<string, int> class_generic_table = new Dictionary<string, int>();
|
||||
ParameterInfo[] pis = scope.CompiledMethod.GetParameters();
|
||||
Type[] tt = scope.CompiledMethod.GetGenericArguments();
|
||||
int gen_ind = 0;
|
||||
if (!scope.IsExtension)
|
||||
sb.Append(GetShortTypeName(scope.CompiledMethod.DeclaringType));
|
||||
else
|
||||
{
|
||||
gen_ind = 1;
|
||||
generic_param_args = new Dictionary<string, string>();
|
||||
for (int i = 0; i < pis.Length; i++)
|
||||
{
|
||||
|
|
@ -1661,7 +1663,7 @@ namespace PascalABCCompiler.Parsers
|
|||
if (scope.CompiledMethod.GetGenericArguments().Length > 0)
|
||||
{
|
||||
sb.Append('<');
|
||||
for (int i = 1; i < tt.Length; i++)
|
||||
for (int i = gen_ind; i < tt.Length; i++)
|
||||
{
|
||||
if (class_generic_table.ContainsKey(tt[i].Name))
|
||||
{
|
||||
|
|
|
|||
52
TestSuite/arithm11.pas
Normal file
52
TestSuite/arithm11.pas
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
procedure Test(b1: byte; var b2: byte);
|
||||
begin
|
||||
assert(b1 < b2);
|
||||
end;
|
||||
procedure Test(b1: shortint; var b2: shortint);
|
||||
begin
|
||||
assert(b1 < b2);
|
||||
end;
|
||||
procedure Test(b1: word; var b2: word);
|
||||
begin
|
||||
assert(b1 < b2);
|
||||
end;
|
||||
procedure Test(b1: longword; var b2: longword);
|
||||
begin
|
||||
assert(b1 < b2);
|
||||
end;
|
||||
procedure Test(b1: uint64; var b2: uint64);
|
||||
begin
|
||||
assert(b1 < b2);
|
||||
end;
|
||||
begin
|
||||
var b1, b2: byte;
|
||||
b1 := 254;
|
||||
b2 := 255;
|
||||
Test(b1, b2);
|
||||
var w1, w2: word;
|
||||
w1 := word.MaxValue - 1;
|
||||
w2 := word.MaxValue;
|
||||
Test(w1, w2);
|
||||
var s1, s2: word;
|
||||
s1 := shortint.MaxValue - 1;
|
||||
s2 := shortint.MaxValue;
|
||||
Test(s1, s2);
|
||||
var lw1, lw2: longword;
|
||||
lw1 := longword.MaxValue - 1;
|
||||
lw2 := longword.MaxValue;
|
||||
Test(lw1, lw2);
|
||||
var ui1, ui2: uint64;
|
||||
ui1 := uint64.MaxValue - 1;
|
||||
ui2 := uint64.MaxValue;
|
||||
Test(ui1, ui2);
|
||||
var arr: array of byte := (b1, b2);
|
||||
Test(arr[0], arr[1]);
|
||||
var arr2: array of word := (w1, w2);
|
||||
Test(arr2[0], arr2[1]);
|
||||
var arr3: array of longword := (lw1, lw2);
|
||||
Test(arr3[0], arr3[1]);
|
||||
var arr4: array of uint64 := (ui1, ui2);
|
||||
Test(arr4[0], arr4[1]);
|
||||
var arr5: array of shortint := (shortint.MaxValue-1, shortint.MaxValue);
|
||||
Test(arr5[0], arr5[1]);
|
||||
end.
|
||||
11
TestSuite/errors/err0214.pas
Normal file
11
TestSuite/errors/err0214.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
type A = interface
|
||||
function f: integer;
|
||||
end;
|
||||
|
||||
B = class(A)
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
|
||||
end.
|
||||
10
TestSuite/errors/err0215.pas
Normal file
10
TestSuite/errors/err0215.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
type A = interface
|
||||
function f: integer;
|
||||
begin
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
|
||||
end.
|
||||
|
|
@ -11833,6 +11833,15 @@ namespace PascalABCCompiler.TreeConverter
|
|||
AddError(get_location(_function_header.where_defs), "WHERE_SECTION_MUST_BE_ONLY_IN_FIRST_DECLARATION");
|
||||
}
|
||||
}
|
||||
if (context.converted_type != null && context.converted_type.IsInterface)
|
||||
{
|
||||
if (body_exists)
|
||||
{
|
||||
AddError(new InterfaceFunctionWithBody(get_location(_function_header)));
|
||||
}
|
||||
common_method_node cmnode = context.top_function as common_method_node;
|
||||
context.set_virtual_abstract(cmnode);
|
||||
}
|
||||
convertion_data_and_alghoritms.create_function_return_variable(context.top_function, si);
|
||||
|
||||
/*if (_function_header.name != null && context.converted_compiled_type != null && context.top_function is common_namespace_function_node)
|
||||
|
|
|
|||
Loading…
Reference in a new issue