* also give a warning when a field masks an identifier from a category

* also give a warning when a field/parameter/local variable masks an
    identifier from a class helper that's in scope

git-svn-id: trunk@29498 -
This commit is contained in:
Jonas Maebe 2015-01-17 15:38:29 +00:00
parent 990e47f2d3
commit 8fe981cccb
3 changed files with 28 additions and 2 deletions

1
.gitattributes vendored
View File

@ -11760,6 +11760,7 @@ tests/test/thlp44.pp svneol=native#text/pascal
tests/test/thlp45.pp svneol=native#text/pascal
tests/test/thlp46.pp svneol=native#text/pascal
tests/test/thlp47.pp svneol=native#text/pascal
tests/test/thlp48.pp svneol=native#text/plain
tests/test/thlp5.pp svneol=native#text/pascal
tests/test/thlp6.pp svneol=native#text/pascal
tests/test/thlp7.pp svneol=native#text/pascal

View File

@ -1498,8 +1498,9 @@ implementation
happen due to all possible categories being imported via
CocoaAll }
warn:=
is_objccategory(tdef(hsym.owner.defowner)) and
(sym.typ in [paravarsym,localvarsym]);
(is_objccategory(tdef(hsym.owner.defowner)) or
is_classhelper(tdef(hsym.owner.defowner))) and
(sym.typ in [paravarsym,localvarsym,fieldvarsym]);
DuplicateSym(hashedid,sym,hsym,warn);
result:=true;
end;

24
tests/test/thlp48.pp Normal file
View File

@ -0,0 +1,24 @@
{ %fail }
{ %opt=-vw -Sew }
program thelper;
{$mode objfpc}
type
TTest = class;
TTestHelper = class helper for TTest
procedure Test;
end;
TTest = class
Test: LongInt;
end;
procedure TTestHelper.Test;
begin
end;
begin
end.