From aba3f8f1620dfc0d02185fae5c8a96989448af62 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Mon, 25 Feb 2019 21:17:24 +0000 Subject: [PATCH] * fixed over-eager rejection of tobjecttype.fieldname expression after r40785 (mantis #35149) git-svn-id: trunk@41474 - --- .gitattributes | 2 ++ compiler/pexpr.pas | 4 +--- tests/webtbf/tw35149a.pp | 14 ++++++++++++++ tests/webtbs/tw35149.pp | 14 ++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 tests/webtbf/tw35149a.pp create mode 100644 tests/webtbs/tw35149.pp diff --git a/.gitattributes b/.gitattributes index fff0ece2f9..273f551a1c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14806,6 +14806,7 @@ tests/webtbf/tw34821.pp svneol=native#text/plain tests/webtbf/tw3488.pp svneol=native#text/plain tests/webtbf/tw3495.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/tw3562.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/tw35139.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/tw3529.pp svneol=native#text/plain tests/webtbs/tw3531.pp svneol=native#text/plain diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index e9a8058dce..251c613ef1 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -1400,9 +1400,7 @@ implementation (current_procinfo.procdef.struct=structh))) then Message(parser_e_only_class_members) 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); end; end; diff --git a/tests/webtbf/tw35149a.pp b/tests/webtbf/tw35149a.pp new file mode 100644 index 0000000000..b0cab6c482 --- /dev/null +++ b/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. diff --git a/tests/webtbs/tw35149.pp b/tests/webtbs/tw35149.pp new file mode 100644 index 0000000000..1247969f8c --- /dev/null +++ b/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.