mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-05 19:27:45 +02:00
fcl-passrc: fixed no hint when published method hides ancestor method
This commit is contained in:
parent
2e409dda39
commit
412a9b37df
@ -5485,7 +5485,9 @@ begin
|
||||
if (Proc.Visibility=visStrictPrivate)
|
||||
or ((Proc.Visibility=visPrivate)
|
||||
and (Proc.GetModule<>Data^.Proc.GetModule)) then
|
||||
// a private private is hidden by definition -> no hint
|
||||
// a private method is hidden by definition -> no hint
|
||||
else if (Proc.Visibility=visPublished) then
|
||||
// a published can hide (used for overloading rtti) -> no hint
|
||||
else if (ProcScope.ImplProc<>nil) // not abstract, external
|
||||
and (not ProcHasImplElements(ProcScope.ImplProc)) then
|
||||
// hidden method has implementation, but no statements -> useless
|
||||
|
@ -811,6 +811,7 @@ type
|
||||
Procedure TestRTTI_DynArray;
|
||||
Procedure TestRTTI_ArrayNestedAnonymous;
|
||||
Procedure TestRTTI_PublishedMethodOverloadFail;
|
||||
Procedure TestRTTI_PublishedMethodHideNoHint;
|
||||
Procedure TestRTTI_PublishedMethodExternalFail;
|
||||
Procedure TestRTTI_PublishedClassPropertyFail;
|
||||
Procedure TestRTTI_PublishedClassFieldFail;
|
||||
@ -29450,6 +29451,59 @@ begin
|
||||
ConvertProgram;
|
||||
end;
|
||||
|
||||
procedure TTestModule.TestRTTI_PublishedMethodHideNoHint;
|
||||
begin
|
||||
WithTypeInfo:=true;
|
||||
StartUnit(false);
|
||||
Add([
|
||||
'interface',
|
||||
'type',
|
||||
' TObject = class',
|
||||
' end;',
|
||||
' {$M+}',
|
||||
' TBird = class',
|
||||
' procedure Fly;',
|
||||
' end;',
|
||||
' {$M-}',
|
||||
'type',
|
||||
' TEagle = class(TBird)',
|
||||
' procedure Fly;',
|
||||
' end;',
|
||||
'implementation',
|
||||
'procedure TBird.Fly;',
|
||||
'begin',
|
||||
'end;',
|
||||
'procedure TEagle.Fly;',
|
||||
'begin',
|
||||
'end;',
|
||||
'']);
|
||||
ConvertUnit;
|
||||
CheckSource('TestRTTI_PublishedMethodHideNoHint',
|
||||
LinesToStr([ // statements
|
||||
'rtl.createClass(this, "TObject", null, function () {',
|
||||
' this.$init = function () {',
|
||||
' };',
|
||||
' this.$final = function () {',
|
||||
' };',
|
||||
'});',
|
||||
'rtl.createClass(this, "TBird", this.TObject, function () {',
|
||||
' this.Fly = function () {',
|
||||
' };',
|
||||
' var $r = this.$rtti;',
|
||||
' $r.addMethod("Fly", 0, null);',
|
||||
'});',
|
||||
'rtl.createClass(this, "TEagle", this.TBird, function () {',
|
||||
' this.Fly = function () {',
|
||||
' };',
|
||||
' var $r = this.$rtti;',
|
||||
' $r.addMethod("Fly", 0, null);',
|
||||
'});',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
]));
|
||||
CheckResolverUnexpectedHints(true);
|
||||
end;
|
||||
|
||||
procedure TTestModule.TestRTTI_PublishedMethodExternalFail;
|
||||
begin
|
||||
WithTypeInfo:=true;
|
||||
|
Loading…
Reference in New Issue
Block a user