From 88d406d9b6b8bf8e7d450c4f8c00c6fff9f8e155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Sun, 3 Jun 2018 19:49:55 +0200 Subject: [PATCH] fix in patterns --- Compiler/PCU/PCUWrappers.cs | 2 + .../SyntaxTreeVisitorNodes/Patterns.cs | 1 - _GenerateAllSetups.bat | 6 +- _RebuildReleaseAndRunTests.bat | 6 +- bin/TestRunner.exe | Bin 30720 -> 31744 bytes bin/TestRunner.pas | 237 ++++++++++-------- 6 files changed, 140 insertions(+), 112 deletions(-) diff --git a/Compiler/PCU/PCUWrappers.cs b/Compiler/PCU/PCUWrappers.cs index 0f85d41da..1062cd29e 100644 --- a/Compiler/PCU/PCUWrappers.cs +++ b/Compiler/PCU/PCUWrappers.cs @@ -319,6 +319,8 @@ namespace PascalABCCompiler.PCU { if (base_type != null && base_type.IsDelegate) return base_type.find_in_type(name, CurrentScope, no_search_in_extension_methods); + else if (name == compiler_string_consts.deconstruct_method_name) + return SystemLibrary.SystemLibrary.object_type.find_in_type(name, CurrentScope, no_search_in_extension_methods); return sil; } diff --git a/TreeConverter/TreeConversion/SyntaxTreeVisitorNodes/Patterns.cs b/TreeConverter/TreeConversion/SyntaxTreeVisitorNodes/Patterns.cs index 606dee6dc..484aa216e 100644 --- a/TreeConverter/TreeConversion/SyntaxTreeVisitorNodes/Patterns.cs +++ b/TreeConverter/TreeConversion/SyntaxTreeVisitorNodes/Patterns.cs @@ -27,7 +27,6 @@ namespace PascalABCCompiler.TreeConverter var parameterTypes = variableDefinitions.Select(x => x.vars_type == null ? null : convert_strong(x.vars_type)).ToArray(); List candidates = new List(); List deducedParametersList = new List(); - var allDeconstructs = patternInstance.type.find_in_type(compiler_string_consts.deconstruct_method_name, context.CurrentScope); foreach (var canditateSymbol in allDeconstructs) { diff --git a/_GenerateAllSetups.bat b/_GenerateAllSetups.bat index e6948d4e4..1376404f9 100644 --- a/_GenerateAllSetups.bat +++ b/_GenerateAllSetups.bat @@ -50,7 +50,11 @@ ExecHide.exe gacutil.exe /i ..\bin\Lib\PABCRtl.dll cd ..\bin REM MPGORunner.exe -TestRunner.exe +TestRunner.exe 1 +TestRunner.exe 2 +TestRunner.exe 3 +TestRunner.exe 4 +TestRunner.exe 5 cd ..\ReleaseGenerators PascalABCNET_ALL.bat diff --git a/_RebuildReleaseAndRunTests.bat b/_RebuildReleaseAndRunTests.bat index 24e33ade6..7c11ea932 100644 --- a/_RebuildReleaseAndRunTests.bat +++ b/_RebuildReleaseAndRunTests.bat @@ -33,7 +33,11 @@ ExecHide.exe gacutil.exe /i ..\bin\Lib\PABCRtl.dll cd ..\bin REM MPGORunner.exe -TestRunner.exe +TestRunner.exe 1 +TestRunner.exe 2 +TestRunner.exe 3 +TestRunner.exe 4 +TestRunner.exe 5 cd .. GOTO EXIT diff --git a/bin/TestRunner.exe b/bin/TestRunner.exe index 10777a946a76ba9c8bb2a57217a932c1d917a515..09afeb86ccc5924ee7768586ee9142301476beb6 100644 GIT binary patch delta 6795 zcmbtZd3aP+mOuBtr7BhRYD=g}NXSwN$%BNDKmw^4Fd(}`vO+@G5*7iGiY1|0lnTNq zpdj%g3ew-lBHiF1Emq5CTBM2EsH3)MGY&L55*J3?5M+9kreV&#?`4rz{^@*Qop*n~ zv)ps;`l{0M9clT2Y+e`mJ|nIk%)hfhiJjO1mLWk6GI?w3Gn17!9tWsm`6S7)6TpF* zwMZnf_ec(_BU!eLrAVdXXBpc-vdIc|m`q58tw`YCIQ&phpn4iWUJ!sF#*fO{oAaXO zG(t!#J0aDh%#m;J!%(AJ0c_R%0b=tch&9YTAnA;4k&DSA(RbxkLKyo_Nkr*T6NAFZ zg-%t%iGs6-6A$SA1s$8E@)-B2i6tTic4n*jnT|2Wsw@Cmk3)mW{V_3B)D;8Z0nFT}LkG=d`R7$l$m5Now0l9lXPOC}a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JO|90&Y&*ifv+voT;byhCF%WJKev7m9nqYVu+d|C6S p{|sOi6E1>0$N7ZTL>Fyg?AD^kjQDL8-#xHzP{6U|bJCiv|6g4l>2Ux6 diff --git a/bin/TestRunner.pas b/bin/TestRunner.pas index 76cf4d6ad..081e51dd3 100644 --- a/bin/TestRunner.pas +++ b/bin/TestRunner.pas @@ -9,8 +9,11 @@ uses PascalABCCompiler, System.IO, System.Diagnostics; -var TestSuiteDir: string; -var PathSeparator: string := Path.DirectorySeparatorChar; +var + TestSuiteDir: string; + +var + PathSeparator: string := Path.DirectorySeparatorChar; function IsUnix: boolean; begin @@ -21,13 +24,13 @@ function GetTestSuiteDir: string; begin var dir := Path.GetDirectoryName(GetEXEFileName()); var ind := dir.LastIndexOf('bin'); - Result := dir.Substring(0,ind)+'TestSuite'; + Result := dir.Substring(0, ind) + 'TestSuite'; end; function GetLibDir: string; begin var dir := Path.GetDirectoryName(GetEXEFileName()); - Result := dir+PathSeparator+'Lib'; + Result := dir + PathSeparator + 'Lib'; end; procedure CompileErrorTests(withide: boolean); @@ -35,15 +38,15 @@ begin var comp := new Compiler(); - var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'errors','*.pas'); + var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'errors', '*.pas'); for var i := 0 to files.Length - 1 do begin var content := &File.ReadAllText(files[i]); if content.StartsWith('//winonly') and IsUnix then continue; - var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton); + var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton); co.Debug := true; - co.OutputDirectory := TestSuiteDir+PathSeparator+'errors'; + co.OutputDirectory := TestSuiteDir + PathSeparator + 'errors'; co.UseDllForSystemUnits := false; co.RunWithEnvironment := withide; comp.ErrorsList.Clear(); @@ -52,13 +55,13 @@ begin comp.Compile(co); if comp.ErrorsList.Count = 0 then begin - System.Windows.Forms.MessageBox.Show('Compilation of error sample '+files[i]+' was successfull'+System.Environment.NewLine); + System.Windows.Forms.MessageBox.Show('Compilation of error sample ' + files[i] + ' was successfull' + System.Environment.NewLine); Halt(); end else if comp.ErrorsList.Count = 1 then begin if comp.ErrorsList[0].GetType() = typeof(PascalABCCompiler.Errors.CompilerInternalError) then - System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString()); + System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString()); end; if i mod 20 = 0 then System.GC.Collect(); @@ -71,15 +74,15 @@ begin var comp := new Compiler(); - var files := Directory.GetFiles(TestSuiteDir,'*.pas'); + var files := Directory.GetFiles(TestSuiteDir, '*.pas'); for var i := 0 to files.Length - 1 do begin var content := &File.ReadAllText(files[i]); if content.StartsWith('//winonly') and IsUnix then continue; - var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton); + var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton); co.Debug := true; - co.OutputDirectory := TestSuiteDir+PathSeparator+'exe'; + co.OutputDirectory := TestSuiteDir + PathSeparator + 'exe'; co.UseDllForSystemUnits := withdll; co.RunWithEnvironment := false; co.IgnoreRtlErrors := false; @@ -90,7 +93,7 @@ begin comp.Compile(co); if comp.ErrorsList.Count > 0 then begin - System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString()); + System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString()); Halt(); end; if i mod 20 = 0 then @@ -106,15 +109,15 @@ begin var comp := new Compiler(); - var files := Directory.GetFiles(TestSuiteDir+PathSeparator+dir,'*.pas'); + var files := Directory.GetFiles(TestSuiteDir + PathSeparator + dir, '*.pas'); for var i := 0 to files.Length - 1 do begin var content := &File.ReadAllText(files[i]); if content.StartsWith('//winonly') and IsUnix then continue; - var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton); + var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton); co.Debug := true; - co.OutputDirectory := TestSuiteDir+PathSeparator+dir; + co.OutputDirectory := TestSuiteDir + PathSeparator + dir; co.UseDllForSystemUnits := withdll; co.RunWithEnvironment := false; co.IgnoreRtlErrors := false; @@ -124,7 +127,7 @@ begin comp.Compile(co); if comp.ErrorsList.Count > 0 then begin - System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString()); + System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString()); Halt(); end; if i mod 20 = 0 then @@ -136,14 +139,14 @@ end; procedure CompileAllUnits; begin var comp := new Compiler(); - var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'units','*.pas'); - var dir := TestSuiteDir+PathSeparator+'units'+PathSeparator; + var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'units', '*.pas'); + var dir := TestSuiteDir + PathSeparator + 'units' + PathSeparator; for var i := 0 to files.Length - 1 do begin var content := &File.ReadAllText(files[i]); if content.StartsWith('//winonly') and IsUnix then continue; - var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton); + var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton); co.Debug := true; co.OutputDirectory := dir; co.UseDllForSystemUnits := false; @@ -153,7 +156,7 @@ begin comp.Compile(co); if comp.ErrorsList.Count > 0 then begin - System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString()); + System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString()); Halt(); end; end; @@ -165,22 +168,22 @@ begin System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName()); var comp := new Compiler(); - var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'usesunits','*.pas'); + var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'usesunits', '*.pas'); for var i := 0 to files.Length - 1 do begin var content := &File.ReadAllText(files[i]); if content.StartsWith('//winonly') and IsUnix then continue; - var co: CompilerOptions := new CompilerOptions(files[i],CompilerOptions.OutputType.ConsoleApplicaton); + var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton); co.Debug := true; - co.OutputDirectory := TestSuiteDir+PathSeparator+'exe'; + co.OutputDirectory := TestSuiteDir + PathSeparator + 'exe'; co.UseDllForSystemUnits := false; comp.ErrorsList.Clear(); comp.Warnings.Clear(); comp.Compile(co); if comp.ErrorsList.Count > 0 then begin - System.Windows.Forms.MessageBox.Show('Compilation of '+files[i]+' failed'+System.Environment.NewLine+comp.ErrorsList[0].ToString()); + System.Windows.Forms.MessageBox.Show('Compilation of ' + files[i] + ' failed' + System.Environment.NewLine + comp.ErrorsList[0].ToString()); Halt(); end; end; @@ -190,42 +193,42 @@ end; procedure CopyPCUFiles; begin System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName()); - var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'units','*.pcu'); + var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'units', '*.pcu'); foreach fname: string in files do begin - &File.Move(fname,TestSuiteDir+PathSeparator+'usesunits'+PathSeparator+Path.GetFileName(fname)); + &File.Move(fname, TestSuiteDir + PathSeparator + 'usesunits' + PathSeparator + Path.GetFileName(fname)); end; end; procedure RunAllTests(redirectIO: boolean); begin - var files := Directory.GetFiles(TestSuiteDir+PathSeparator+'exe','*.exe'); + var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'exe', '*.exe'); for var i := 0 to files.Length - 1 do begin - var psi := new System.Diagnostics.ProcessStartInfo(files[i]); - psi.CreateNoWindow := true; - psi.UseShellExecute := false; - - psi.WorkingDirectory := TestSuiteDir+PathSeparator+'exe'; + var psi := new System.Diagnostics.ProcessStartInfo(files[i]); + psi.CreateNoWindow := true; + psi.UseShellExecute := false; + + psi.WorkingDirectory := TestSuiteDir + PathSeparator + 'exe'; {psi.RedirectStandardInput := true; psi.RedirectStandardOutput := true; psi.RedirectStandardError := true;} - var p: Process := new Process(); - p.StartInfo := psi; - p.Start(); - if redirectIO then - p.StandardInput.WriteLine('GO'); + var p: Process := new Process(); + p.StartInfo := psi; + p.Start(); + if redirectIO then + p.StandardInput.WriteLine('GO'); //p.StandardInput.AutoFlush := true; //var p := System.Diagnostics.Process.Start(psi); - - while not p.HasExited do - Sleep(10); - if p.ExitCode <> 0 then - begin - System.Windows.Forms.MessageBox.Show('Running of '+files[i]+' failed. Exit code is not 0'); - Halt; - end; + + while not p.HasExited do + Sleep(10); + if p.ExitCode <> 0 then + begin + System.Windows.Forms.MessageBox.Show('Running of ' + files[i] + ' failed. Exit code is not 0'); + Halt; + end; end; end; @@ -238,45 +241,45 @@ function GetLineByPos(lines: array of string; pos: integer): integer; begin var cum_pos := 0; for var i := 0 to lines.Length - 1 do - for var j := 0 to lines[j].Length - 1 do - begin - if cum_pos = pos then + for var j := 0 to lines[j].Length - 1 do begin - Result := i + 1; - exit; + if cum_pos = pos then + begin + Result := i + 1; + exit; + end; + Inc(cum_pos); end; - Inc(cum_pos); - end; end; function GetColByPos(lines: array of string; pos: integer): integer; begin var cum_pos := 0; for var i := 0 to lines.Length - 1 do - for var j := 0 to lines[j].Length - 1 do - begin - if cum_pos = pos then + for var j := 0 to lines[j].Length - 1 do begin - Result := j + 1; - exit; + if cum_pos = pos then + begin + Result := j + 1; + exit; + end; + Inc(cum_pos); end; - Inc(cum_pos); - end; end; procedure RunIntellisenseTests; begin PascalABCCompiler.StringResourcesLanguage.CurrentTwoLetterISO := 'ru'; - CodeCompletion.CodeCompletionTester.TestIntellisense(TestSuiteDir+PathSeparator+'intellisense_tests'); + CodeCompletion.CodeCompletionTester.TestIntellisense(TestSuiteDir + PathSeparator + 'intellisense_tests'); end; procedure RunFormatterTests; begin CodeCompletion.FormatterTester.Test(); - var errors := &File.ReadAllText(TestSuiteDir+PathSeparator+'formatter_tests'+PathSeparator+'output'+PathSeparator+'log.txt'); + var errors := &File.ReadAllText(TestSuiteDir + PathSeparator + 'formatter_tests' + PathSeparator + 'output' + PathSeparator + 'log.txt'); if not string.IsNullOrEmpty(errors) then begin - System.Windows.Forms.MessageBox.Show(errors+System.Environment.NewLine+'more info at TestSuite/formatter_tests/output/log.txt'); + System.Windows.Forms.MessageBox.Show(errors + System.Environment.NewLine + 'more info at TestSuite/formatter_tests/output/log.txt'); Halt; end; end; @@ -296,34 +299,34 @@ end; procedure ClearExeDir; begin - ClearDirByPattern(TestSuiteDir+PathSeparator+'exe','*.*'); - ClearDirByPattern(TestSuiteDir+PathSeparator+'CompilationSamples','*.exe'); - ClearDirByPattern(TestSuiteDir+PathSeparator+'CompilationSamples','*.mdb'); - ClearDirByPattern(TestSuiteDir+PathSeparator+'CompilationSamples','*.pdb'); - ClearDirByPattern(TestSuiteDir+PathSeparator+'CompilationSamples','*.pcu'); - ClearDirByPattern(TestSuiteDir+PathSeparator+'pabcrtl_tests','*.exe'); - ClearDirByPattern(TestSuiteDir+PathSeparator+'pabcrtl_tests','*.pdb'); - ClearDirByPattern(TestSuiteDir+PathSeparator+'pabcrtl_tests','*.mdb'); - ClearDirByPattern(TestSuiteDir+PathSeparator+'pabcrtl_tests','*.pcu'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'exe', '*.*'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.exe'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.mdb'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.pdb'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'CompilationSamples', '*.pcu'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.exe'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.pdb'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.mdb'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'pabcrtl_tests', '*.pcu'); end; procedure DeletePCUFiles; begin - ClearDirByPattern(TestSuiteDir+PathSeparator+'usesunits','*.pcu'); + ClearDirByPattern(TestSuiteDir + PathSeparator + 'usesunits', '*.pcu'); end; procedure DeletePABCSystemPCU; begin - var dir := Path.Combine(Path.GetDirectoryName(GetEXEFileName()),'Lib'); - var pcu := Path.Combine(dir,'PABCSystem.pcu'); + var dir := Path.Combine(Path.GetDirectoryName(GetEXEFileName()), 'Lib'); + var pcu := Path.Combine(dir, 'PABCSystem.pcu'); end; procedure CopyLibFiles; begin - var files := Directory.GetFiles(GetLibDir(),'*.pas'); + var files := Directory.GetFiles(GetLibDir(), '*.pas'); foreach f: string in files do begin - &File.Copy(f, TestSuiteDir+PathSeparator+'CompilationSamples'+PathSeparator+Path.GetFileName(f), true); + &File.Copy(f, TestSuiteDir + PathSeparator + 'CompilationSamples' + PathSeparator + Path.GetFileName(f), true); end; end; @@ -332,39 +335,55 @@ begin try TestSuiteDir := GetTestSuiteDir; System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName()); - DeletePCUFiles; - ClearExeDir; - CompileAllRunTests(false); - CopyLibFiles; - CompileAllCompilationTests('CompilationSamples',false); - CompileAllUnits; - CopyPCUFiles; - CompileAllUsesUnits; - CompileErrorTests(false); - writeln('Tests compiled successfully'); - RunAllTests(false); - writeln('Tests run successfully'); - ClearExeDir; - DeletePCUFiles; - CompileAllRunTests(true); - writeln('Tests with pabcrtl compiled successfully'); - CompileAllCompilationTests('pabcrtl_tests',true); - RunAllTests(false); - writeln('Tests with pabcrtl run successfully'); - ClearExeDir; - CompileAllRunTests(false, true); - writeln('Tests in 32bit mode compiled successfully'); - RunAllTests(false); - writeln('Tests in 32bit run successfully'); - System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName()); - RunExpressionsExtractTests; - writeln('Intellisense expression tests run successfully'); - RunIntellisenseTests; - writeln('Intellisense tests run successfully'); - RunFormatterTests; - writeln('Formatter tests run successfully'); + if (ParamCount = 0) or (ParamStr(1) = '1') then + begin + DeletePCUFiles; + ClearExeDir; + CompileAllRunTests(false); + end; + + if (ParamCount = 0) or (ParamStr(1) = '2') then + begin + CopyLibFiles; + CompileAllCompilationTests('CompilationSamples', false); + end; + if (ParamCount = 0) or (ParamStr(1) = '3') then + begin + CompileAllUnits; + CopyPCUFiles; + CompileAllUsesUnits; + CompileErrorTests(false); + writeln('Tests compiled successfully'); + end; + if (ParamCount = 0) or (ParamStr(1) = '4') then + begin + RunAllTests(false); + writeln('Tests run successfully'); + ClearExeDir; + DeletePCUFiles; + end; + if (ParamCount = 0) or (ParamStr(1) = '5') then + begin + CompileAllRunTests(true); + writeln('Tests with pabcrtl compiled successfully'); + CompileAllCompilationTests('pabcrtl_tests', true); + RunAllTests(false); + writeln('Tests with pabcrtl run successfully'); + ClearExeDir; + CompileAllRunTests(false, true); + writeln('Tests in 32bit mode compiled successfully'); + RunAllTests(false); + writeln('Tests in 32bit run successfully'); + System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName()); + RunExpressionsExtractTests; + writeln('Intellisense expression tests run successfully'); + RunIntellisenseTests; + writeln('Intellisense tests run successfully'); + RunFormatterTests; + writeln('Formatter tests run successfully'); + end; except on e: Exception do - assert(false,e.ToString()); + assert(false, e.ToString()); end; end. \ No newline at end of file