소스 검색

* for tp mode don't allow unitname reuse

git-svn-id: trunk@8158 -
peter 18 년 전
부모
커밋
0fc65c5eec
4개의 변경된 파일27개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 0
      .gitattributes
  2. 3 2
      compiler/pdecsub.pas
  3. 4 4
      compiler/symtable.pas
  4. 19 0
      tests/webtbf/tw6957.pp

+ 1 - 0
.gitattributes

@@ -7365,6 +7365,7 @@ tests/webtbf/tw6631.pp svneol=native#text/plain
 tests/webtbf/tw6686.pp svneol=native#text/plain
 tests/webtbf/tw6796.pp svneol=native#text/plain
 tests/webtbf/tw6922.pp svneol=native#text/plain
+tests/webtbf/tw6957.pp -text
 tests/webtbf/tw6970.pp svneol=native#text/plain
 tests/webtbf/tw7070.pp svneol=native#text/plain
 tests/webtbf/tw7322.pp svneol=native#text/plain

+ 3 - 2
compiler/pdecsub.pas

@@ -787,8 +787,9 @@ implementation
                  else
                    begin
                      { when the other symbol is a unit symbol then hide the unit
-                       symbol }
-                     if (srsym.typ=unitsym) then
+                       symbol, this is not supported in tp7 }
+                     if not(m_tp7 in current_settings.modeswitches) and
+                        (srsym.typ=unitsym) then
                       begin
                         HideSym(srsym);
                         searchagain:=true;

+ 4 - 4
compiler/symtable.pas

@@ -1256,10 +1256,10 @@ implementation
         hsym:=tsym(FindWithHash(hashedid));
         if assigned(hsym) then
           begin
-            { Delphi you can have a symbol with the same name as the
+            { Delphi (contrary to TP) you can have a symbol with the same name as the
               unit, the unit can then not be accessed anymore using
               <unit>.<id>, so we can hide the symbol }
-            if (m_duplicate_names in current_settings.modeswitches) and
+            if (m_delphi in current_settings.modeswitches) and
                (hsym.typ=symconst.unitsym) then
               HideSym(hsym)
             else
@@ -1310,10 +1310,10 @@ implementation
         hsym:=tsym(FindWithHash(hashedid));
         if assigned(hsym) then
           begin
-            { Delphi you can have a symbol with the same name as the
+            { Delphi (contrary to TP) you can have a symbol with the same name as the
               unit, the unit can then not be accessed anymore using
               <unit>.<id>, so we can hide the symbol }
-            if (m_duplicate_names in current_settings.modeswitches) and
+            if (m_delphi in current_settings.modeswitches) and
                (hsym.typ=symconst.unitsym) then
               HideSym(hsym)
             else

+ 19 - 0
tests/webtbf/tw6957.pp

@@ -0,0 +1,19 @@
+{ %fail }
+
+{$IFDEF FPC}
+ {$MODE TP}
+{$ENDIF FPC}
+unit tw6957;
+
+interface
+
+function tw6957: boolean;
+
+implementation
+
+function tw6957: boolean;
+begin
+ tw6957 := true;
+end;
+
+end.