Explorar el Código

* fixed over-eager rejection of tobjecttype.fieldname expression after r40785
(mantis #35149)

git-svn-id: trunk@41474 -

Jonas Maebe hace 6 años
padre
commit
aba3f8f162
Se han modificado 4 ficheros con 31 adiciones y 3 borrados
  1. 2 0
      .gitattributes
  2. 1 3
      compiler/pexpr.pas
  3. 14 0
      tests/webtbf/tw35149a.pp
  4. 14 0
      tests/webtbs/tw35149.pp

+ 2 - 0
.gitattributes

@@ -14806,6 +14806,7 @@ tests/webtbf/tw34821.pp svneol=native#text/plain
 tests/webtbf/tw3488.pp svneol=native#text/plain
 tests/webtbf/tw3488.pp svneol=native#text/plain
 tests/webtbf/tw3495.pp svneol=native#text/plain
 tests/webtbf/tw3495.pp svneol=native#text/plain
 tests/webtbf/tw3502.pp svneol=native#text/plain
 tests/webtbf/tw3502.pp svneol=native#text/plain
+tests/webtbf/tw35149a.pp svneol=native#text/plain
 tests/webtbf/tw3553.pp svneol=native#text/plain
 tests/webtbf/tw3553.pp svneol=native#text/plain
 tests/webtbf/tw3562.pp svneol=native#text/plain
 tests/webtbf/tw3562.pp svneol=native#text/plain
 tests/webtbf/tw3583.pp svneol=native#text/plain
 tests/webtbf/tw3583.pp svneol=native#text/plain
@@ -16537,6 +16538,7 @@ tests/webtbs/tw3504.pp svneol=native#text/plain
 tests/webtbs/tw3506.pp svneol=native#text/plain
 tests/webtbs/tw3506.pp svneol=native#text/plain
 tests/webtbs/tw35139.pp svneol=native#text/plain
 tests/webtbs/tw35139.pp svneol=native#text/plain
 tests/webtbs/tw35139a.pp svneol=native#text/plain
 tests/webtbs/tw35139a.pp svneol=native#text/plain
+tests/webtbs/tw35149.pp svneol=native#text/plain
 tests/webtbs/tw3523.pp svneol=native#text/plain
 tests/webtbs/tw3523.pp svneol=native#text/plain
 tests/webtbs/tw3529.pp svneol=native#text/plain
 tests/webtbs/tw3529.pp svneol=native#text/plain
 tests/webtbs/tw3531.pp svneol=native#text/plain
 tests/webtbs/tw3531.pp svneol=native#text/plain

+ 1 - 3
compiler/pexpr.pas

@@ -1400,9 +1400,7 @@ implementation
                                 (current_procinfo.procdef.struct=structh))) then
                                 (current_procinfo.procdef.struct=structh))) then
                               Message(parser_e_only_class_members)
                               Message(parser_e_only_class_members)
                             else
                             else
-                              Message(parser_e_only_class_members_via_class_ref)
-                          else if isobjecttype then
-                            Message(parser_e_only_static_members_via_object_type);
+                              Message(parser_e_only_class_members_via_class_ref);
                           p1:=csubscriptnode.create(sym,p1);
                           p1:=csubscriptnode.create(sym,p1);
                         end;
                         end;
                    end;
                    end;

+ 14 - 0
tests/webtbf/tw35149a.pp

@@ -0,0 +1,14 @@
+{ %fail }
+
+program project1;
+
+{$mode objfpc}
+type
+  TestObject = object
+  var
+    TestNested: Integer;
+  end;
+
+begin
+  writeln(TestObject.TestNested);
+end. 

+ 14 - 0
tests/webtbs/tw35149.pp

@@ -0,0 +1,14 @@
+{ %norun }
+
+program project1;
+
+{$mode objfpc}
+type
+  TestObject = object
+  var
+    TestNested: Integer;
+  end;
+
+begin
+  writeln(SizeOf(TestObject.TestNested));
+end.