Procházet zdrojové kódy

* 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 před 13 roky
rodič
revize
1ec48299cf
3 změnil soubory, kde provedl 9 přidání a 21 odebrání
  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/tdefault14.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/tdefault3.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 }
 
-{ Objective C types are disallowed as well }
+{ Objective C types are implicit pointer types -> nil pointer }
 program tdefault15;
 
 {$mode objfpc}
@@ -10,9 +9,17 @@ program tdefault15;
 type
   TTest = objcclass
   end;
+  TTestProto = objcprotocol
+  end;
 
 var
   t: TTest;
+  tp: TTestProto;
 begin
   t := Default(TTest);
+  if assigned(t) then
+    halt(1);
+  tp := Default(TTestProto);
+  if assigned(tp) then
+    halt(2);
 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.