瀏覽代碼

* allow default() on Objective-C classes and protocols: the compiler already
allows it, and they're plain pointer-based types -> nil is fine

git-svn-id: trunk@21360 -

Jonas Maebe 13 年之前
父節點
當前提交
1ec48299cf
共有 3 個文件被更改,包括 9 次插入21 次删除
  1. 0 1
      .gitattributes
  2. 9 2
      tests/test/tdefault15.pp
  3. 0 18
      tests/test/tdefault16.pp

+ 0 - 1
.gitattributes

@@ -10533,7 +10533,6 @@ tests/test/tdefault12.pp svneol=native#text/pascal
 tests/test/tdefault13.pp svneol=native#text/pascal
 tests/test/tdefault13.pp svneol=native#text/pascal
 tests/test/tdefault14.pp svneol=native#text/pascal
 tests/test/tdefault14.pp svneol=native#text/pascal
 tests/test/tdefault15.pp svneol=native#text/pascal
 tests/test/tdefault15.pp svneol=native#text/pascal
-tests/test/tdefault16.pp svneol=native#text/pascal
 tests/test/tdefault2.pp svneol=native#text/pascal
 tests/test/tdefault2.pp svneol=native#text/pascal
 tests/test/tdefault3.pp svneol=native#text/pascal
 tests/test/tdefault3.pp svneol=native#text/pascal
 tests/test/tdefault4.pp svneol=native#text/pascal
 tests/test/tdefault4.pp svneol=native#text/pascal

+ 9 - 2
tests/test/tdefault15.pp

@@ -1,7 +1,6 @@
-{ %FAIL }
 { %target=darwin }
 { %target=darwin }
 
 
-{ Objective C types are disallowed as well }
+{ Objective C types are implicit pointer types -> nil pointer }
 program tdefault15;
 program tdefault15;
 
 
 {$mode objfpc}
 {$mode objfpc}
@@ -10,9 +9,17 @@ program tdefault15;
 type
 type
   TTest = objcclass
   TTest = objcclass
   end;
   end;
+  TTestProto = objcprotocol
+  end;
 
 
 var
 var
   t: TTest;
   t: TTest;
+  tp: TTestProto;
 begin
 begin
   t := Default(TTest);
   t := Default(TTest);
+  if assigned(t) then
+    halt(1);
+  tp := Default(TTestProto);
+  if assigned(tp) then
+    halt(2);
 end.
 end.

+ 0 - 18
tests/test/tdefault16.pp

@@ -1,18 +0,0 @@
-{ %FAIL }
-{ %target=darwin }
-
-{ Objective C types are disallowed as well }
-program tdefault16;
-
-{$mode objfpc}
-{$modeswitch objectivec1}
-
-type
-  TTest = objcprotocol
-  end;
-
-var
-  t: TTest;
-begin
-  t := Default(TTest);
-end.