diff --git a/.gitattributes b/.gitattributes index e3ea41d907..7886ecbc77 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10761,6 +10761,7 @@ tests/webtbs/tw17950.pp svneol=native#text/pascal tests/webtbs/tw17952a.pp svneol=native#text/pascal tests/webtbs/tw17952b.pp svneol=native#text/pascal tests/webtbs/tw1798.pp svneol=native#text/plain +tests/webtbs/tw17986.pp svneol=native#text/pascal tests/webtbs/tw17998.pp svneol=native#text/plain tests/webtbs/tw18013.pp svneol=native#text/plain tests/webtbs/tw1820.pp svneol=native#text/plain diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 42910e95d6..efd20792f2 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -351,6 +351,7 @@ implementation srsymtable : TSymtable; s,sorg : TIDString; t : ttoken; + objdef : tobjectdef; begin s:=pattern; sorg:=orgpattern; @@ -358,16 +359,20 @@ implementation { use of current parsed object: - classes can be used also in classes - objects can be parameters } - if assigned(current_objectdef) and - (current_objectdef.objname^=pattern) and - ( - (testcurobject=2) or - is_class_or_interface_or_objc(current_objectdef) - )then + objdef:=current_objectdef; + while Assigned(objdef) and (objdef.typ=objectdef) do begin - consume(_ID); - def:=current_objectdef; - exit; + if (tobjectdef(objdef).objname^=pattern) and + ( + (testcurobject=2) or + is_class_or_interface_or_objc(objdef) + ) then + begin + consume(_ID); + def:=objdef; + exit; + end; + objdef:=tobjectdef(tobjectdef(objdef).owner.defowner); end; { Use the special searchsym_type that ignores records,objects and parameters } diff --git a/tests/webtbs/tw17986.pp b/tests/webtbs/tw17986.pp new file mode 100644 index 0000000000..b83defeab2 --- /dev/null +++ b/tests/webtbs/tw17986.pp @@ -0,0 +1,20 @@ +program tw17986; + +{$mode delphi} + +type + TFoo1 = class + public + type + TFoo2 = class + procedure Proc(value: TFoo1); // was error: Type "TFoo1" is not completely defined + end; + end; + +procedure TFoo1.TFoo2.Proc(value: TFoo1); +begin +end; + +begin +end. +