bug fix #396
This commit is contained in:
parent
16ffdc9a05
commit
da373ae907
|
|
@ -2,15 +2,28 @@ begin
|
|||
var b: byte := 2;
|
||||
var i: integer := 3;
|
||||
var s: shortint := 4;
|
||||
var sm: smallint := 1;
|
||||
var w: word := 5;
|
||||
var lw: longword := 6;
|
||||
var i64: int64 := 7;
|
||||
var ui64: uint64 := 8;
|
||||
assert(min(b,i)=2);
|
||||
assert(min(s,i)=3);
|
||||
assert(min(s,sm)=1);
|
||||
assert(min(w,s)=4);
|
||||
assert(min(b,lw)=2);
|
||||
assert(min(i,lw)=3);
|
||||
assert(min(s,lw)=4);
|
||||
assert(min(b,s)=2);
|
||||
assert(min(b,i64)=2);
|
||||
assert(min(i64,ui64)=7);
|
||||
assert(min(b,255)=2);
|
||||
assert(min(s,255)=4);
|
||||
|
||||
assert(min(sm,65535)=1);
|
||||
assert(min(i,255)=3);
|
||||
assert(min(w,65535)=5);
|
||||
assert(min(lw,255)=6);
|
||||
assert(min(i64,255)=7);
|
||||
assert(min(ui64,255)=8);
|
||||
end.
|
||||
|
|
@ -2018,13 +2018,26 @@ namespace PascalABCCompiler.TreeConverter
|
|||
else
|
||||
{
|
||||
type_compare tc = type_table.compare_types(best_function.return_value_type, fn.return_value_type);
|
||||
if (tc == type_compare.greater_type)
|
||||
if (best_function.return_value_type.is_standard_type && fn.return_value_type.is_standard_type)
|
||||
{
|
||||
to_remove.Add(best_function);
|
||||
best_function = fn;
|
||||
if (tc == type_compare.less_type)
|
||||
{
|
||||
to_remove.Add(best_function);
|
||||
best_function = fn;
|
||||
}
|
||||
else if (tc == type_compare.greater_type)
|
||||
to_remove.Add(fn);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tc == type_compare.greater_type)
|
||||
{
|
||||
to_remove.Add(best_function);
|
||||
best_function = fn;
|
||||
}
|
||||
else if (tc == type_compare.less_type)
|
||||
to_remove.Add(fn);
|
||||
}
|
||||
else if (tc == type_compare.less_type)
|
||||
to_remove.Add(fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,11 @@ namespace PascalABCCompiler.TreeRealization
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public virtual bool is_standard_type
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool is_nullable_type
|
||||
{
|
||||
get
|
||||
|
|
@ -2566,7 +2571,15 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override bool is_standard_type
|
||||
{
|
||||
get
|
||||
{
|
||||
return NetHelper.NetHelper.IsStandType(_compiled_type);
|
||||
}
|
||||
}
|
||||
|
||||
public override function_node generic_function_container
|
||||
{
|
||||
get
|
||||
|
|
|
|||
Loading…
Reference in a new issue