This commit is contained in:
Ivan Bondarev 2021-10-17 12:04:24 +02:00
parent bc726bbfc0
commit 5548def725
11 changed files with 47 additions and 7 deletions

View file

@ -1,4 +1,5 @@
function f(i: integer): string;
//!GetType не объявлен в типе function(i: integer): string
function f(i: integer): string;
begin
end;

View file

@ -1,4 +1,5 @@
function f(i: integer): integer;
//!Ожидался порядковый или строковый тип
function f(i: integer): integer;
begin
end;

View file

@ -1,4 +1,5 @@
procedure p1<T>(o: T);
//!Невозможно инстанцировать, так как тип IEnumerable<char> не наследован от string
procedure p1<T>(o: T);
where T: string;
begin
o.Length.Println;

View file

@ -1,4 +1,5 @@
unit err0429;
//!Класс t1 абстрактный и не может иметь атрибут sealed, потому что метод p1 не реализован
unit err0429;
type
t0 = partial abstract class

View file

@ -1,4 +1,5 @@
unit err0430;
//!Класс t1 абстрактный и не может иметь атрибут sealed, потому что метод p1 не реализован
unit err0430;
interface
type

View file

@ -0,0 +1,10 @@
//!Неизвестное имя 't1'
unit err0431;
uses err0432;
type
t3 = class(err0432.t1)
end;
end.

View file

@ -0,0 +1,7 @@
//exclude
{$savepcu false}
unit err0432;
uses err0433;
end.

View file

@ -0,0 +1,8 @@
//exclude
{$savepcu false}
unit err0433;
type
t1 = class end;
end.

View file

@ -871,7 +871,7 @@ namespace PascalABCCompiler.TreeConverter
int num = names.names.Count - 1;
if (di is namespace_node)
{
si = (di as namespace_node).find(names.names[num].name);
si = (di as namespace_node).findOnlyInNamespace(names.names[num].name);
if (si == null && throw_error)
AddError(new UndefinedNameReference(names.names[num].name, syntax_tree_visitor.get_location(names.names[num])));
}

Binary file not shown.

View file

@ -45,7 +45,13 @@ begin
var content := &File.ReadAllText(files[i]);
if content.StartsWith('//winonly') and IsUnix then
continue;
if content.StartsWith('//exclude') then
continue;
var errorMessage := '';
if content.StartsWith('//!') then
begin
errorMessage := content.Substring(3, content.IndexOf(System.Environment.NewLine)-3).Trim;
end;
var co: CompilerOptions := new CompilerOptions(files[i], CompilerOptions.OutputType.ConsoleApplicaton);
co.Debug := true;
co.OutputDirectory := TestSuiteDir + PathSeparator + 'errors';
@ -70,6 +76,10 @@ begin
raise new Exception('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 (errorMessage <> '') and (comp.ErrorsList[0].Message.Trim <> errorMessage) then
begin
System.Windows.Forms.MessageBox.Show('Wrong error message in file ' + files[i] + ', should '+errorMessage+', is '+comp.ErrorsList[0].Message);
end;
end;
if i mod 50 = 0 then
System.GC.Collect();