parent
c312928add
commit
5d4f7091fe
|
|
@ -2618,7 +2618,6 @@ namespace PascalABCCompiler
|
|||
{
|
||||
if (FileName.IndexOf(Path.DirectorySeparatorChar) != -1)
|
||||
{
|
||||
|
||||
File.Copy(Path.Combine(Environment.CurrentDirectory, FileName), Path.Combine(Environment.CurrentDirectory, Path.GetFileName(FileName)), true);
|
||||
if (CompilerOptions.useOutputDirectory)
|
||||
File.Copy(Path.Combine(Environment.CurrentDirectory, FileName), Path.Combine(CompilerOptions.OutputDirectory, Path.GetFileName(FileName)), true);
|
||||
|
|
|
|||
|
|
@ -12362,12 +12362,10 @@ begin
|
|||
Result := Self.Split(delim, System.StringSplitOptions.RemoveEmptyEntries);
|
||||
end;
|
||||
|
||||
const SpaceDelimiters = ' '+#9#10#13;
|
||||
|
||||
/// Преобразует строку в массив слов, используя в качестве разделителей символы из строки delim
|
||||
function ToWords(Self: string; delim: string := SpaceDelimiters): array of string; extensionmethod;
|
||||
/// Преобразует строку в массив слов, используя в качестве разделителей символы из строки delims
|
||||
function ToWords(Self: string; delims: string := ' '): array of string; extensionmethod;
|
||||
begin
|
||||
Result := Self.Split(delim.ToCharArray, System.StringSplitOptions.RemoveEmptyEntries);
|
||||
Result := Self.Split(delims.ToCharArray, System.StringSplitOptions.RemoveEmptyEntries);
|
||||
end;
|
||||
|
||||
procedure PassSpaces(var s: string; var from: integer);
|
||||
|
|
|
|||
23
TestSuite/errors/err0390.pas
Normal file
23
TestSuite/errors/err0390.pas
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
type
|
||||
t0 = abstract class end;
|
||||
|
||||
t1<T> = class
|
||||
where T: t0;
|
||||
|
||||
procedure p1(x: byte);
|
||||
begin
|
||||
var p: Action0 := ()->
|
||||
begin
|
||||
|
||||
|
||||
Writeln(x);
|
||||
|
||||
Writeln(new T);
|
||||
|
||||
end;
|
||||
p();
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
begin end.
|
||||
26
TestSuite/lambdas_generics8.pas
Normal file
26
TestSuite/lambdas_generics8.pas
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
type
|
||||
t0 = abstract class
|
||||
end;
|
||||
|
||||
t2 = class(t0)
|
||||
end;
|
||||
|
||||
t1<T> = class
|
||||
where T: t0, constructor;
|
||||
public obj: T;
|
||||
procedure p1;
|
||||
begin
|
||||
var p: Action0 := ()->
|
||||
begin
|
||||
obj := new T;
|
||||
end;
|
||||
p();
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
var o := new t1<t2>;
|
||||
o.p1;
|
||||
assert((o.obj <> nil) and (o.obj.GetType = typeof(t2)));
|
||||
end.
|
||||
25
TestSuite/lambdas_generics9.pas
Normal file
25
TestSuite/lambdas_generics9.pas
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
type
|
||||
t0 = abstract class end;
|
||||
|
||||
t1<T> = class
|
||||
where T: t0, constructor;
|
||||
i: byte;
|
||||
function MakeT := new T;
|
||||
|
||||
function f1(x: byte): ()->T := ()->
|
||||
begin
|
||||
|
||||
i := x;
|
||||
|
||||
Result := MakeT;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
t2 = class(t0) end;
|
||||
|
||||
begin
|
||||
var a := new t1<t2>;
|
||||
var obj := a.f1(5)();
|
||||
assert(a.i = 5);
|
||||
end.
|
||||
|
|
@ -1113,7 +1113,12 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
|
||||
if (_visitor.context._ctn != null && _visitor.context._ctn.generic_params != null)
|
||||
{
|
||||
genericParameterEliminations.AddRange(generic_parameter_eliminations.make_eliminations_common(_visitor.context._ctn.generic_params));
|
||||
List<generic_parameter_eliminations> lst = generic_parameter_eliminations.make_eliminations_common(_visitor.context._ctn.generic_params);
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
if (!lst[i].has_default_ctor && _visitor.context._ctn.generic_params[i] is common_type_node)
|
||||
lst[i].has_default_ctor = (_visitor.context._ctn.generic_params[i] as common_type_node).has_default_constructor;
|
||||
genericParameterEliminations.AddRange(lst);
|
||||
|
||||
}
|
||||
|
||||
if (_visitor.context.top_function != null && _visitor.context.top_function.generic_params != null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue