Errors and cleanup

This commit is contained in:
Sun Serega 2022-09-27 18:03:46 +03:00
parent 258d8d6c6a
commit aea94d1df4
3 changed files with 46 additions and 3 deletions

View 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.

View 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.

View file

@ -3983,7 +3983,7 @@ namespace PascalABCCompiler.TreeConverter
else
AddError(get_location(_class_definition), converted_type.AbstractReason.Explanation, converted_type.name, converted_type.AbstractReason.ObjName);
}
return;
break;
case PascalABCCompiler.SyntaxTree.class_keyword.Record:
if (context.CurrentScope is SymbolTable.BlockScope)
@ -4032,7 +4032,7 @@ namespace PascalABCCompiler.TreeConverter
}*/
context.leave_record();
return_value(converted_type);
return;
break;
//ssyy owns
case PascalABCCompiler.SyntaxTree.class_keyword.Interface:
if (converted_type.is_value || !converted_type.IsInterface)
@ -4070,7 +4070,7 @@ namespace PascalABCCompiler.TreeConverter
}
//hard_node_test_and_visit(_class_definition.body);
context.leave_block();
return;
break;
//\ssyy owns
default:
throw new NotSupportedError(get_location(_class_definition));