mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 18:49:16 +02:00
fcl-passrc: fixed unit implementation uses namespace as unit intf identifier
git-svn-id: trunk@46751 -
This commit is contained in:
parent
545ee82ec4
commit
dd82f63c3f
@ -5672,17 +5672,21 @@ begin
|
|||||||
ParentScope:=Scopes[ScopeCount-2];
|
ParentScope:=Scopes[ScopeCount-2];
|
||||||
if ParentScope is TPasSectionScope then
|
if ParentScope is TPasSectionScope then
|
||||||
begin
|
begin
|
||||||
|
// check unit interface and implementation duplicates
|
||||||
OlderIdentifier:=TPasSectionScope(ParentScope).FindLocalIdentifier(aName);
|
OlderIdentifier:=TPasSectionScope(ParentScope).FindLocalIdentifier(aName);
|
||||||
if IsGeneric then
|
repeat
|
||||||
OlderIdentifier:=SkipGenericTypes(OlderIdentifier,TypeParamCnt);
|
if IsGeneric then
|
||||||
if OlderIdentifier<>nil then
|
OlderIdentifier:=SkipGenericTypes(OlderIdentifier,TypeParamCnt);
|
||||||
begin
|
if OlderIdentifier=nil then break;
|
||||||
OlderEl:=OlderIdentifier.Element;
|
OlderEl:=OlderIdentifier.Element;
|
||||||
if (Identifier.Kind=pikSimple)
|
if (Identifier.Kind=pikNamespace)
|
||||||
|
or (OlderIdentifier.Kind=pikNamespace) then
|
||||||
|
else if (Identifier.Kind=pikSimple)
|
||||||
or (OlderIdentifier.Kind=pikSimple) then
|
or (OlderIdentifier.Kind=pikSimple) then
|
||||||
RaiseMsg(20190818141630,nDuplicateIdentifier,sDuplicateIdentifier,
|
RaiseMsg(20190818141630,nDuplicateIdentifier,sDuplicateIdentifier,
|
||||||
[aName,GetElementSourcePosStr(OlderEl)],El);
|
[aName,GetElementSourcePosStr(OlderEl)],El);
|
||||||
end;
|
OlderIdentifier:=OlderIdentifier.NextSameIdentifier;
|
||||||
|
until OlderIdentifier=nil;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -373,6 +373,7 @@ type
|
|||||||
Procedure TestUnit_DottedPrg;
|
Procedure TestUnit_DottedPrg;
|
||||||
Procedure TestUnit_DottedUnit;
|
Procedure TestUnit_DottedUnit;
|
||||||
Procedure TestUnit_DottedExpr;
|
Procedure TestUnit_DottedExpr;
|
||||||
|
Procedure TestUnit_DottedSystem;
|
||||||
Procedure TestUnit_DuplicateDottedUsesFail;
|
Procedure TestUnit_DuplicateDottedUsesFail;
|
||||||
Procedure TestUnit_DuplicateUsesDiffName;
|
Procedure TestUnit_DuplicateUsesDiffName;
|
||||||
Procedure TestUnit_Unit1DotUnit2Fail;
|
Procedure TestUnit_Unit1DotUnit2Fail;
|
||||||
@ -5975,6 +5976,31 @@ begin
|
|||||||
ParseProgram;
|
ParseProgram;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestResolver.TestUnit_DottedSystem;
|
||||||
|
begin
|
||||||
|
AddModuleWithIntfImplSrc('System.SysUtils.pas',
|
||||||
|
LinesToStr([
|
||||||
|
'type TFlag = word;'
|
||||||
|
]),
|
||||||
|
''
|
||||||
|
);
|
||||||
|
AddModuleWithIntfImplSrc('UnitA.pas',
|
||||||
|
LinesToStr([
|
||||||
|
''
|
||||||
|
]),
|
||||||
|
LinesToStr([
|
||||||
|
'uses System.SysUtils;',
|
||||||
|
'type TSize = TFlag;',
|
||||||
|
'type TWidth = System.SysUtils.TFlag;',
|
||||||
|
'type TBird = System.integer;',
|
||||||
|
'type TEagle = integer;',
|
||||||
|
'']) );
|
||||||
|
StartProgram(true);
|
||||||
|
Add('uses UnitA;');
|
||||||
|
Add('begin');
|
||||||
|
ParseProgram;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTestResolver.TestUnit_DuplicateDottedUsesFail;
|
procedure TTestResolver.TestUnit_DuplicateDottedUsesFail;
|
||||||
begin
|
begin
|
||||||
AddModuleWithIntfImplSrc('ns.unit2.pp',
|
AddModuleWithIntfImplSrc('ns.unit2.pp',
|
||||||
|
Loading…
Reference in New Issue
Block a user