fix #1956
This commit is contained in:
parent
160e9308e1
commit
66b5221d1e
22
TestSuite/errors/err0323.pas
Normal file
22
TestSuite/errors/err0323.pas
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
type
|
||||||
|
t1 = class
|
||||||
|
constructor Create(i: integer);
|
||||||
|
begin
|
||||||
|
//Create();
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor Create(f: ()->byte);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor Create();
|
||||||
|
begin
|
||||||
|
//var a := 1;
|
||||||
|
Create(()->1);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
{var p := new t1;
|
||||||
|
p.Create(()->1);}
|
||||||
|
end.
|
||||||
|
|
@ -448,7 +448,13 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
if (syntax_tree_visitor.inherited_ident_processing)
|
if (syntax_tree_visitor.inherited_ident_processing)
|
||||||
syntax_tree_visitor.AddError(new SimpleSemanticError(loc, "INHERITED_CONSTRUCTOR_CALL_MUST_BE_FIRST"));
|
syntax_tree_visitor.AddError(new SimpleSemanticError(loc, "INHERITED_CONSTRUCTOR_CALL_MUST_BE_FIRST"));
|
||||||
else
|
else
|
||||||
syntax_tree_visitor.AddError(new SimpleSemanticError(loc, "CAN_NOT_CALL_CONSTRUCTOR_AS_PROCEDURE"));
|
{
|
||||||
|
var lambdasInParameters = syntax_nodes_parameters?.Any(ex => ex is SyntaxTree.function_lambda_definition) ?? false;
|
||||||
|
if (lambdasInParameters)
|
||||||
|
syntax_tree_visitor.AddError(new SimpleSemanticError(loc, "LAMBDAS_IN_CONSTRUCTOR_PARAMETERS_ARE_FORBIDDEN_IN_THIS_CONTEXT"));
|
||||||
|
else syntax_tree_visitor.AddError(new SimpleSemanticError(loc, "CAN_NOT_CALL_CONSTRUCTOR_AS_PROCEDURE"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
cmc = ccc;
|
cmc = ccc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,5 @@ UNNAMED_RECORD_CANNOT_CONTAIN_METHODS=Unnamed records can not contain methods
|
||||||
UNNAMED_RECORD_CANNOT_CONTAIN_CONSTRUCTORS=Unnamed records can not contain constructors
|
UNNAMED_RECORD_CANNOT_CONTAIN_CONSTRUCTORS=Unnamed records can not contain constructors
|
||||||
UNNAMED_RECORD_CAN_CONTAIN_ONLY_ONE_PUBLIC_VISIBILITY_SECTION=Unnamed records can contain only one section with public visibility
|
UNNAMED_RECORD_CAN_CONTAIN_ONLY_ONE_PUBLIC_VISIBILITY_SECTION=Unnamed records can contain only one section with public visibility
|
||||||
UNNAMED_RECORD_CANNOT_CONTAIN_SEVERAL_VISIBILITY_SECTIONS=Unnamed records can not contain several visibility section
|
UNNAMED_RECORD_CANNOT_CONTAIN_SEVERAL_VISIBILITY_SECTIONS=Unnamed records can not contain several visibility section
|
||||||
OPENMP_CONTROLLED_CONSTRUCTIONS_CANNOT_CONTAIN_LAMBDAS=OpenMP-directive-based constructions cannot contain lambdas
|
OPENMP_CONTROLLED_CONSTRUCTIONS_CANNOT_CONTAIN_LAMBDAS=OpenMP-directive-based constructions cannot contain lambdas
|
||||||
|
LAMBDAS_IN_CONSTRUCTOR_PARAMETERS_ARE_FORBIDDEN_IN_THIS_CONTEXT=Lambda-expressions as constructor parameters are forbidden in this context
|
||||||
|
|
@ -27,4 +27,5 @@ UNNAMED_RECORD_CANNOT_CONTAIN_METHODS=Безымянные записи не м
|
||||||
UNNAMED_RECORD_CANNOT_CONTAIN_CONSTRUCTORS=Безымянные записи не могут содержать конструкторы
|
UNNAMED_RECORD_CANNOT_CONTAIN_CONSTRUCTORS=Безымянные записи не могут содержать конструкторы
|
||||||
UNNAMED_RECORD_CAN_CONTAIN_ONLY_ONE_PUBLIC_VISIBILITY_SECTION=Безымянные записи могут содержать лишь одну секцию с public-видимостью
|
UNNAMED_RECORD_CAN_CONTAIN_ONLY_ONE_PUBLIC_VISIBILITY_SECTION=Безымянные записи могут содержать лишь одну секцию с public-видимостью
|
||||||
UNNAMED_RECORD_CANNOT_CONTAIN_SEVERAL_VISIBILITY_SECTIONS=Безымянные записи не могут содержать несколько секций видимости
|
UNNAMED_RECORD_CANNOT_CONTAIN_SEVERAL_VISIBILITY_SECTIONS=Безымянные записи не могут содержать несколько секций видимости
|
||||||
OPENMP_CONTROLLED_CONSTRUCTIONS_CANNOT_CONTAIN_LAMBDAS=Лямбда-выражения не могут содержаться внутри конструкций под управлением OpenMP-директив
|
OPENMP_CONTROLLED_CONSTRUCTIONS_CANNOT_CONTAIN_LAMBDAS=Лямбда-выражения не могут содержаться внутри конструкций под управлением OpenMP-директив
|
||||||
|
LAMBDAS_IN_CONSTRUCTOR_PARAMETERS_ARE_FORBIDDEN_IN_THIS_CONTEXT=Лямбда-выражения как параметры конструктора запрещены в этом контексте
|
||||||
Loading…
Reference in a new issue