diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index e16543138..09e3979ab 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "7"; public const string Build = "1"; - public const string Revision = "2709"; + public const string Revision = "2710"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index eb3d9bf97..de2518195 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=7 -%REVISION%=2709 %COREVERSION%=1 +%REVISION%=2710 +%MINOR%=7 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index d6c340bf1..583d37bda 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.7.1.2709 +3.7.1.2710 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 4e6cb1168..d18f5e90a 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.7.1.2709' +!define VERSION '3.7.1.2710' diff --git a/TestSuite/CompilationSamples/ABCDatabases.pas b/TestSuite/CompilationSamples/ABCDatabases.pas index cf9dac7e3..6b4664483 100644 --- a/TestSuite/CompilationSamples/ABCDatabases.pas +++ b/TestSuite/CompilationSamples/ABCDatabases.pas @@ -50,25 +50,41 @@ type public [PrintAttribute(0, -16)] property Name: string read _name; + [PrintAttribute(' ', 1, -3)] + property Gender: ТипПола read getGender; + [PrintAttribute(' ', 2, 3, 'd')] + property Height: integer read _height; + [PrintAttribute(' ',3, 2, 'd')] + property Cls: integer read _cls; + [PrintAttribute(' ', 4, -5)] + property InSunSchool: boolean read _inSunSchool; + end; + + {Ученик = auto class + private + _name: string; + _gender: ТипПола; + _height: integer; + _cls: integer; + _inSunSchool: boolean; + function getGender: ТипПола := _gender; + public [PrintAttribute(0, -16)] property Фамилия: string read _name; [PrintAttribute(' ', 1, -3)] - property Gender: ТипПола read getGender; - [PrintAttribute(' ', 1, -3)] property Пол: ТипПола read getGender; [PrintAttribute(' ', 2, 3, 'd')] - property Height: integer read _height; - [PrintAttribute(' ', 2, 3, 'd')] property Рост: integer read _height; [PrintAttribute(' ',3, 2, 'd')] - property Cls: integer read _cls; - [PrintAttribute(' ',3, 2, 'd')] property Класс: integer read _cls; [PrintAttribute(' ', 4, -5)] - property InSunSchool: boolean read _inSunSchool; - [PrintAttribute(' ', 4, -5)] property УчитсяВКШ: boolean read _inSunSchool; - + end;} + Ученик = auto class + Фамилия: string; + Класс, Рост: integer; + Пол: ТипПола; + УчитсяВКШ: boolean; end; function GenderToТипПола(a: string): ТипПола := a = 'Муж' ? Муж : Жен; @@ -266,7 +282,18 @@ begin .Select(w->new Country(w[0],w[1],w[2].ToInteger,w[3])).ToArray; end; -function ЗаполнитьМассивУчеников: array of Pupil; +function ЗаполнитьМассивУчеников: array of Ученик; +begin + var fname := 'c:\Program files (x86)\PascalABC.NET\Files\Databases\Ученики.csv'; + if fname = '' then + raise new System.ApplicationException('Не найден массив учеников Databases\Ученики.csv'); + Result := ReadLines(fname) + .Select(s->s.ToWords(';')) + .Select(w->new Ученик(w[0],w[1].ToInteger,w[4].ToInteger,GenderToТипПола(w[2]), + InSunschoolToBoolean(w[3]))).ToArray; +end; + +function GetPupils: array of Pupil; begin var fname := 'c:\Program files (x86)\PascalABC.NET\Files\Databases\Ученики.csv'; if fname = '' then @@ -277,8 +304,6 @@ begin InSunschoolToBoolean(w[3]))).ToArray; end; -function GetPupils: array of Pupil := ЗаполнитьМассивУчеников; - function GetFitness: array of Fitness; begin var fname := 'Fitness.tst'; diff --git a/TestSuite/match1.pas b/TestSuite/match1.pas new file mode 100644 index 000000000..f20d06784 --- /dev/null +++ b/TestSuite/match1.pas @@ -0,0 +1,7 @@ +begin + match new string('d',1) with + //Ошибка времени выполнения: Индекс находился вне границ массива. + ['d']: Assert(1=1); + else Assert(1=2); + end; +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 954ea169c..b0265990b 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -15955,10 +15955,12 @@ namespace PascalABCCompiler.TreeConverter } else { + var lbvr = nspr.expression as local_block_variable_reference; + //String 1 based if (parameters.expressions.Count == 1 && nspr.property.comprehensive_type == SystemLibrary.SystemLibrary.string_type && - !SemanticRules.NullBasedStrings) + !SemanticRules.NullBasedStrings && (lbvr == null || !lbvr.var.name.StartsWith("<>match"))) { nspr.fact_parametres.AddElement( ConstructDecExpr( diff --git a/bin/Lib/ABCDatabases.pas b/bin/Lib/ABCDatabases.pas index cf9dac7e3..6b4664483 100644 --- a/bin/Lib/ABCDatabases.pas +++ b/bin/Lib/ABCDatabases.pas @@ -50,25 +50,41 @@ type public [PrintAttribute(0, -16)] property Name: string read _name; + [PrintAttribute(' ', 1, -3)] + property Gender: ТипПола read getGender; + [PrintAttribute(' ', 2, 3, 'd')] + property Height: integer read _height; + [PrintAttribute(' ',3, 2, 'd')] + property Cls: integer read _cls; + [PrintAttribute(' ', 4, -5)] + property InSunSchool: boolean read _inSunSchool; + end; + + {Ученик = auto class + private + _name: string; + _gender: ТипПола; + _height: integer; + _cls: integer; + _inSunSchool: boolean; + function getGender: ТипПола := _gender; + public [PrintAttribute(0, -16)] property Фамилия: string read _name; [PrintAttribute(' ', 1, -3)] - property Gender: ТипПола read getGender; - [PrintAttribute(' ', 1, -3)] property Пол: ТипПола read getGender; [PrintAttribute(' ', 2, 3, 'd')] - property Height: integer read _height; - [PrintAttribute(' ', 2, 3, 'd')] property Рост: integer read _height; [PrintAttribute(' ',3, 2, 'd')] - property Cls: integer read _cls; - [PrintAttribute(' ',3, 2, 'd')] property Класс: integer read _cls; [PrintAttribute(' ', 4, -5)] - property InSunSchool: boolean read _inSunSchool; - [PrintAttribute(' ', 4, -5)] property УчитсяВКШ: boolean read _inSunSchool; - + end;} + Ученик = auto class + Фамилия: string; + Класс, Рост: integer; + Пол: ТипПола; + УчитсяВКШ: boolean; end; function GenderToТипПола(a: string): ТипПола := a = 'Муж' ? Муж : Жен; @@ -266,7 +282,18 @@ begin .Select(w->new Country(w[0],w[1],w[2].ToInteger,w[3])).ToArray; end; -function ЗаполнитьМассивУчеников: array of Pupil; +function ЗаполнитьМассивУчеников: array of Ученик; +begin + var fname := 'c:\Program files (x86)\PascalABC.NET\Files\Databases\Ученики.csv'; + if fname = '' then + raise new System.ApplicationException('Не найден массив учеников Databases\Ученики.csv'); + Result := ReadLines(fname) + .Select(s->s.ToWords(';')) + .Select(w->new Ученик(w[0],w[1].ToInteger,w[4].ToInteger,GenderToТипПола(w[2]), + InSunschoolToBoolean(w[3]))).ToArray; +end; + +function GetPupils: array of Pupil; begin var fname := 'c:\Program files (x86)\PascalABC.NET\Files\Databases\Ученики.csv'; if fname = '' then @@ -277,8 +304,6 @@ begin InSunschoolToBoolean(w[3]))).ToArray; end; -function GetPupils: array of Pupil := ЗаполнитьМассивУчеников; - function GetFitness: array of Fitness; begin var fname := 'Fitness.tst';