Merge branch 'master' into SearchDirectoryArg

This commit is contained in:
SunSerega 2021-01-24 20:19:42 +02:00
commit d47209ef36
18 changed files with 2648 additions and 2552 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "7";
public const string Build = "2";
public const string Revision = "2806";
public const string Revision = "2809";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=2
%REVISION%=2806
%MINOR%=7
%REVISION%=2809
%COREVERSION%=2
%MAJOR%=3

View file

@ -2,7 +2,7 @@
// This CSharp output file generated by Gardens Point LEX
// Version: 1.1.3.301
// Machine: DESKTOP-G8V08V4
// DateTime: 17.01.2021 19:14:30
// DateTime: 18.01.2021 18:43:04
// UserName: ?????????
// GPLEX input file <ABCPascal.lex>
// GPLEX frame file <embedded resource>

View file

@ -2234,6 +2234,13 @@ var_decl_part
typed_var_init_expression
: typed_const_plus
{ $$ = $1; }
| const_simple_expr tkDotDot const_term // SSM 18/01/20
{
if (parsertools.build_tree_for_formatter)
$$ = new diapason_expr($1,$3,@$);
else
$$ = new diapason_expr_new($1,$3,@$);
}
| expl_func_decl_lambda
{ $$ = $1; }
| identifier tkArrow lambda_function_body

File diff suppressed because it is too large Load diff

View file

@ -301,6 +301,10 @@ script=

View file

@ -1 +1 @@
3.7.2.2806
3.7.2.2809

View file

@ -1 +1 @@
!define VERSION '3.7.2.2806'
!define VERSION '3.7.2.2809'

View file

@ -1620,6 +1620,11 @@ begin
var sz := Size(host.DataContext);
if sz.Width = 0 then
sz.Width := GraphWindow.Width;
if sz.Height = 0 then
sz.Height := GraphWindow.Height;
var bmp := new RenderTargetBitmap(Round(sz.Width*scalex), Round(sz.Height*scaley), dpiX, dpiY, PixelFormats.Pbgra32);
var myvis := new DrawingVisual();

View file

@ -5235,27 +5235,6 @@ begin
res := self;
end;
// -----------------------------------------------------------------------------
// ReadLexem
// -----------------------------------------------------------------------------
{function ReadLexem: string;
begin
var c: char;
repeat
c := CurrentIOSystem.read_symbol;
until not char.IsWhiteSpace(c);
var sb := new System.Text.StringBuilder;
repeat
sb.Append(c);
c := char(CurrentIOSystem.peek);
if char.IsWhiteSpace(c) or (c = char(-1)) then // char(-1) - Ctrl-Z во входном потоке
break;
c := CurrentIOSystem.read_symbol;
until False; // accumulate nonspaces
Result := sb.ToString;
end;}
// -----------------------------------------------------
// IOStandardSystem: implementation
// -----------------------------------------------------
@ -5449,9 +5428,9 @@ end;
function ReadLexem: string;
begin
if input.sr <> nil then
{if input.sr <> nil then
Result := ReadLexem(input)
else Result := CurrentIOSystem.ReadLexem;
else} Result := CurrentIOSystem.ReadLexem;
end;
function IOStandardSystem.ReadLexem: string;
@ -6486,6 +6465,11 @@ end;
function ReadLexem(f: Text): string;
begin
if f = input then
begin
Result := ReadLexem;
exit
end;
if f.fi = nil then
raise new System.IO.IOException(GetTranslation(FILE_NOT_ASSIGNED));
if f.sr = nil then

20
TestSuite/delegates18.pas Normal file
View file

@ -0,0 +1,20 @@
var i: integer;
procedure p(x: Object);
begin
i := 1;
end;
procedure p(x: procedure);
begin
i := 2;
end;
procedure x := exit;
procedure xx(a: integer) := exit;
begin
var proc: procedure := x;
p(x);
assert(i = 2);
p(xx);
assert(i = 1);
end.

View file

@ -0,0 +1,43 @@
var i: integer;
type
TBase = class
// Эта FErr должна быть шаблонная и принимать функцию возвращающую шаблонный параметр (T)
procedure PErr<T>(f: object->T) := exit;
end;
TErr<T> = class(TBase)
// А у этой PErr не важно какое возвращаемое значение f
procedure PErr(f: T->byte);
begin
f(default(T));
i := 1;
end;
procedure p1;
begin
// Обязательно "self.", без него не воспроизводится
self.PErr(o->
begin
var p: T->() := procedure(x)->exit;
// Обязательно передача в любую процедуру / функцию (не обязательно процедурную переменную)
// При присвоении переменной не воспроизводится
p(o); //Ошибка: Нельзя преобразовать тип object к T
Result := 0;
end);
end;
end;
begin
var o := new TErr<integer>;
o.p1;
assert(i = 1);
end.

4
TestSuite/typedRange.pas Normal file
View file

@ -0,0 +1,4 @@
begin
var b: IntRange := 1..5;
Assert((b.Low=1) and (b.High=5));
end.

View file

@ -0,0 +1,5 @@
unit u_overloads3;
function f(a: integer) := int64(20);
begin
end.

View file

@ -0,0 +1,7 @@
uses u_overloads3;
function f(a: integer): integer := 10;
begin
var r := f(0);
assert(r = 10);
end.

View file

@ -1259,7 +1259,9 @@ namespace PascalABCCompiler.TreeConverter
{
if ((left.first==null)&&(right.first!=null))
{
return type_conversion_compare.greater_type_conversion;
if (right.from.IsDelegate && right.to.IsDelegate && left.to == SystemLibrary.SystemLibrary.object_type)
return type_conversion_compare.less_type_conversion;//right.first != null из-за структурной эквивалентности процедурных типов и в силу того, что для каждого процедурного типа создается свой класс и и создается пустой метод преобразования типов
return type_conversion_compare.greater_type_conversion;
}
if ((left.first!=null)&&(right.first==null))
{
@ -1432,6 +1434,15 @@ namespace PascalABCCompiler.TreeConverter
}
}
}
if (left_func.return_value_type != null && right_func.return_value_type != null && function_eq_params(left_func, right_func, true))
{
var tc = type_table.compare_types(left_func.return_value_type, right_func.return_value_type);
if (tc == type_compare.less_type)
return method_compare.greater_method;
if (tc == type_compare.greater_type)
return method_compare.less_method;
}
return method_compare.not_comparable_methods;
}
@ -2131,7 +2142,12 @@ namespace PascalABCCompiler.TreeConverter
{
throw lastFailedWhileTryingToCompileLambdaBodyWithGivenParametersException.ExceptionOnCompileBody; // Если перебрали все, но ничто не подошло, то кидаем последнее исключение
}
else if (lastFailedWhileTryingToCompileLambdaBodyWithGivenParametersException != null
&& set_of_possible_functions.Count > 0
&& indefinits.Count == 0)
{
syntax_tree_visitor.RemoveLastError();
}
if (set_of_possible_functions.Count == 0 && indefinits.Count == 0)
{
if (is_op)

View file

@ -1620,6 +1620,11 @@ begin
var sz := Size(host.DataContext);
if sz.Width = 0 then
sz.Width := GraphWindow.Width;
if sz.Height = 0 then
sz.Height := GraphWindow.Height;
var bmp := new RenderTargetBitmap(Round(sz.Width*scalex), Round(sz.Height*scaley), dpiX, dpiY, PixelFormats.Pbgra32);
var myvis := new DrawingVisual();

View file

@ -5235,27 +5235,6 @@ begin
res := self;
end;
// -----------------------------------------------------------------------------
// ReadLexem
// -----------------------------------------------------------------------------
{function ReadLexem: string;
begin
var c: char;
repeat
c := CurrentIOSystem.read_symbol;
until not char.IsWhiteSpace(c);
var sb := new System.Text.StringBuilder;
repeat
sb.Append(c);
c := char(CurrentIOSystem.peek);
if char.IsWhiteSpace(c) or (c = char(-1)) then // char(-1) - Ctrl-Z во входном потоке
break;
c := CurrentIOSystem.read_symbol;
until False; // accumulate nonspaces
Result := sb.ToString;
end;}
// -----------------------------------------------------
// IOStandardSystem: implementation
// -----------------------------------------------------
@ -5449,9 +5428,9 @@ end;
function ReadLexem: string;
begin
if input.sr <> nil then
{if input.sr <> nil then
Result := ReadLexem(input)
else Result := CurrentIOSystem.ReadLexem;
else} Result := CurrentIOSystem.ReadLexem;
end;
function IOStandardSystem.ReadLexem: string;
@ -6486,6 +6465,11 @@ end;
function ReadLexem(f: Text): string;
begin
if f = input then
begin
Result := ReadLexem;
exit
end;
if f.fi = nil then
raise new System.IO.IOException(GetTranslation(FILE_NOT_ASSIGNED));
if f.sr = nil then