Errors and cleanup
This commit is contained in:
parent
258d8d6c6a
commit
aea94d1df4
11
TestSuite/errors/err0512_recursive_inh.pas
Normal file
11
TestSuite/errors/err0512_recursive_inh.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
//!Type 't1<T>' inherits from itself
|
||||||
|
type
|
||||||
|
t1<T> = partial class
|
||||||
|
|
||||||
|
end;
|
||||||
|
t2<T> = class(t1<T>) end;
|
||||||
|
t1<T> = partial class(t2<byte>)
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin end.
|
||||||
32
TestSuite/recursive_where.pas
Normal file
32
TestSuite/recursive_where.pas
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
// issue#2725
|
||||||
|
|
||||||
|
type
|
||||||
|
i0 = interface end;
|
||||||
|
|
||||||
|
base_i<TSelf> = interface
|
||||||
|
where TSelf: base_i<TSelf>;
|
||||||
|
function fi(a: TSelf): TSelf;
|
||||||
|
end;
|
||||||
|
|
||||||
|
base_c<TSelf> = abstract class
|
||||||
|
where TSelf: base_c<TSelf>;
|
||||||
|
function fc(a: TSelf): TSelf; abstract;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class1 = class(i0, base_i<class1>)
|
||||||
|
public function fi(a: class1) := a;
|
||||||
|
end;
|
||||||
|
class2 = class(base_c<class2>, base_i<class2>)
|
||||||
|
public function fi(a: class2) := self;
|
||||||
|
public function fc(a: class2): class2; override := self;
|
||||||
|
end;
|
||||||
|
|
||||||
|
record1 = record(i0, base_i<record1>)
|
||||||
|
public function fi(a: record1) := self;
|
||||||
|
end;
|
||||||
|
|
||||||
|
interface1 = interface(i0, base_i<interface1>)
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin end.
|
||||||
|
|
@ -3983,7 +3983,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
else
|
else
|
||||||
AddError(get_location(_class_definition), converted_type.AbstractReason.Explanation, converted_type.name, converted_type.AbstractReason.ObjName);
|
AddError(get_location(_class_definition), converted_type.AbstractReason.Explanation, converted_type.name, converted_type.AbstractReason.ObjName);
|
||||||
}
|
}
|
||||||
return;
|
break;
|
||||||
case PascalABCCompiler.SyntaxTree.class_keyword.Record:
|
case PascalABCCompiler.SyntaxTree.class_keyword.Record:
|
||||||
|
|
||||||
if (context.CurrentScope is SymbolTable.BlockScope)
|
if (context.CurrentScope is SymbolTable.BlockScope)
|
||||||
|
|
@ -4032,7 +4032,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
}*/
|
}*/
|
||||||
context.leave_record();
|
context.leave_record();
|
||||||
return_value(converted_type);
|
return_value(converted_type);
|
||||||
return;
|
break;
|
||||||
//ssyy owns
|
//ssyy owns
|
||||||
case PascalABCCompiler.SyntaxTree.class_keyword.Interface:
|
case PascalABCCompiler.SyntaxTree.class_keyword.Interface:
|
||||||
if (converted_type.is_value || !converted_type.IsInterface)
|
if (converted_type.is_value || !converted_type.IsInterface)
|
||||||
|
|
@ -4070,7 +4070,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
}
|
}
|
||||||
//hard_node_test_and_visit(_class_definition.body);
|
//hard_node_test_and_visit(_class_definition.body);
|
||||||
context.leave_block();
|
context.leave_block();
|
||||||
return;
|
break;
|
||||||
//\ssyy owns
|
//\ssyy owns
|
||||||
default:
|
default:
|
||||||
throw new NotSupportedError(get_location(_class_definition));
|
throw new NotSupportedError(get_location(_class_definition));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue