瀏覽代碼

compiler: Don't allow duplicate property/procedure identifiers inside object declaration. The code which allowed this for delphi mode was initially written based on invalid test from mantis #0009176. Fixes bug #0020580.

git-svn-id: trunk@19564 -
paul 13 年之前
父節點
當前提交
b8589d98cc
共有 3 個文件被更改,包括 17 次插入4 次删除
  1. 1 0
      .gitattributes
  2. 1 4
      compiler/symtable.pas
  3. 15 0
      tests/webtbf/tw20580.pp

+ 1 - 0
.gitattributes

@@ -11002,6 +11002,7 @@ tests/webtbf/tw2037.pp svneol=native#text/plain
 tests/webtbf/tw2046.pp svneol=native#text/plain
 tests/webtbf/tw2053.pp svneol=native#text/plain
 tests/webtbf/tw2053b.pp svneol=native#text/plain
+tests/webtbf/tw20580.pp svneol=native#text/pascal
 tests/webtbf/tw2070.pp svneol=native#text/plain
 tests/webtbf/tw2128.pp svneol=native#text/plain
 tests/webtbf/tw2129.pp svneol=native#text/plain

+ 1 - 4
compiler/symtable.pas

@@ -1295,10 +1295,7 @@ implementation
                 end;
            end
          else
-           begin
-             if not(m_duplicate_names in current_settings.modeswitches) then
-               result:=inherited checkduplicate(hashedid,sym);
-           end;
+           result:=inherited checkduplicate(hashedid,sym);
       end;
 
 

+ 15 - 0
tests/webtbf/tw20580.pp

@@ -0,0 +1,15 @@
+{%fail}
+{$ifdef fpc}
+  {$mode delphi}
+{$endif}
+type
+  TTestObject = class(TObject)
+  private
+    fValue: integer;
+  protected
+    property Value: integer read fValue write fValue;
+    property Value: integer read fValue;
+  end;
+
+begin
+end.