Selaa lähdekoodia

* disallow new(property) (mantis #13992)

git-svn-id: trunk@13288 -
Jonas Maebe 16 vuotta sitten
vanhempi
commit
47702aa3a5
3 muutettua tiedostoa jossa 80 lisäystä ja 0 poistoa
  1. 2 0
      .gitattributes
  2. 39 0
      tests/webtbf/tw13992.pp
  3. 39 0
      tests/webtbs/tw13992a.pp

+ 2 - 0
.gitattributes

@@ -8601,6 +8601,7 @@ tests/webtbf/tw13563a.pp svneol=native#text/plain
 tests/webtbf/tw1365.pp svneol=native#text/plain
 tests/webtbf/tw13815.pp svneol=native#text/plain
 tests/webtbf/tw1395.pp svneol=native#text/plain
+tests/webtbf/tw13992.pp svneol=native#text/plain
 tests/webtbf/tw1407.pp svneol=native#text/plain
 tests/webtbf/tw1432.pp svneol=native#text/plain
 tests/webtbf/tw1467.pp svneol=native#text/plain
@@ -9161,6 +9162,7 @@ tests/webtbs/tw13872.pp svneol=native#text/plain
 tests/webtbs/tw13890.pp svneol=native#text/plain
 tests/webtbs/tw13948.pp svneol=native#text/plain
 tests/webtbs/tw1398.pp svneol=native#text/plain
+tests/webtbs/tw13992a.pp svneol=native#text/plain
 tests/webtbs/tw1401.pp svneol=native#text/plain
 tests/webtbs/tw1407.pp svneol=native#text/plain
 tests/webtbs/tw1408.pp svneol=native#text/plain

+ 39 - 0
tests/webtbf/tw13992.pp

@@ -0,0 +1,39 @@
+{ %fail }
+
+{ new(property) should fail }
+
+program test_prop;
+
+{$mode delphi}
+
+type
+  TMyRec = record
+    s: string;
+  end;
+  PMyRec = ^TMyRec;
+
+  TSomeClass = class
+  private
+    FMyRec: PMyRec;
+  public
+    constructor Create;
+    destructor Destroy; override;
+    property MyRec: PMyRec read FMyRec write FMyRec;
+  end;
+
+{ TSomeClass }
+
+constructor TSomeClass.Create;
+begin
+  New(MyRec);
+end;
+
+destructor TSomeClass.Destroy;
+begin
+//  Dispose(MyRec);
+  inherited;
+end;
+
+begin
+end.
+

+ 39 - 0
tests/webtbs/tw13992a.pp

@@ -0,0 +1,39 @@
+{ %norun }
+
+{ dispose(property) should be accepted }
+
+program test_prop;
+
+{$mode delphi}
+
+type
+  TMyRec = record
+    s: string;
+  end;
+  PMyRec = ^TMyRec;
+
+  TSomeClass = class
+  private
+    FMyRec: PMyRec;
+  public
+    constructor Create;
+    destructor Destroy; override;
+    property MyRec: PMyRec read FMyRec write FMyRec;
+  end;
+
+{ TSomeClass }
+
+constructor TSomeClass.Create;
+begin
+//  New(MyRec);
+end;
+
+destructor TSomeClass.Destroy;
+begin
+  Dispose(MyRec);
+  inherited;
+end;
+
+begin
+end.
+