From 539ed761ba2897c40c9163e717035869528f24a9 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Wed, 26 Dec 2018 11:26:01 +0000 Subject: [PATCH] * a property access list must only consist of record or object fields; classes are not allowed git-svn-id: trunk@40656 - --- .gitattributes | 2 ++ compiler/pdecvar.pas | 2 ++ tests/tbf/tb0266a.pp | 24 ++++++++++++++++++++++++ tests/tbf/tb0266b.pp | 28 ++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 tests/tbf/tb0266a.pp create mode 100644 tests/tbf/tb0266b.pp diff --git a/.gitattributes b/.gitattributes index 3eb5766734..a4ccacf2ad 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index c32e2619fd..51aef193ed 100644 --- a/compiler/pdecvar.pas +++ b/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 diff --git a/tests/tbf/tb0266a.pp b/tests/tbf/tb0266a.pp new file mode 100644 index 0000000000..aaee1bdee7 --- /dev/null +++ b/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. + diff --git a/tests/tbf/tb0266b.pp b/tests/tbf/tb0266b.pp new file mode 100644 index 0000000000..2c2b72ee0b --- /dev/null +++ b/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. +