Sfoglia il codice sorgente

* a property access list must only consist of record or object fields; classes are not allowed

git-svn-id: trunk@40656 -
svenbarth 6 anni fa
parent
commit
539ed761ba
4 ha cambiato i file con 56 aggiunte e 0 eliminazioni
  1. 2 0
      .gitattributes
  2. 2 0
      compiler/pdecvar.pas
  3. 24 0
      tests/tbf/tb0266a.pp
  4. 28 0
      tests/tbf/tb0266b.pp

+ 2 - 0
.gitattributes

@@ -11084,6 +11084,8 @@ tests/tbf/tb0262.pp svneol=native#text/pascal
 tests/tbf/tb0263.pp svneol=native#text/pascal
 tests/tbf/tb0264.pp svneol=native#text/pascal
 tests/tbf/tb0265.pp svneol=native#text/pascal
+tests/tbf/tb0266a.pp svneol=native#text/pascal
+tests/tbf/tb0266b.pp svneol=native#text/pascal
 tests/tbf/tb0588.pp svneol=native#text/pascal
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain

+ 2 - 0
compiler/pdecvar.pas

@@ -132,6 +132,8 @@ implementation
                      end;
                    _POINT :
                      begin
+                       if not is_object(def) and not is_record(def) then
+                         message(sym_e_type_must_be_rec_or_object);
                        consume(_POINT);
                        if assigned(def) then
                         begin

+ 24 - 0
tests/tbf/tb0266a.pp

@@ -0,0 +1,24 @@
+{ %FAIL }
+
+unit tb0266a;
+
+{$mode objfpc}{$H+}
+
+interface
+
+type
+  TTest1 = class
+    fTest: String;
+  end;
+
+  TTest2 = class
+  private
+    fTest: TTest1;
+  public
+    property Test: String read fTest.fTest;
+  end;
+
+implementation
+
+end.
+

+ 28 - 0
tests/tbf/tb0266b.pp

@@ -0,0 +1,28 @@
+{ %FAIL }
+
+unit tb0266b;
+
+{$mode objfpc}{$H+}
+
+interface
+
+type
+  TTest1 = class
+    fTest: String;
+  end;
+
+  TTest2 = record
+    fTest: TTest1;
+  end;
+
+  TTest3 = class
+  private
+    fTest: TTest2;
+  public
+    property Test: String read fTest.fTest.fTest;
+  end;
+
+implementation
+
+end.
+