* made all objcclasses assignment-compatible with id, and vice versa

git-svn-id: branches/objc@13170 -
This commit is contained in:
Jonas Maebe 2009-05-17 20:04:43 +00:00
parent a63d4e3ad0
commit 112ea5e5a8
3 changed files with 29 additions and 1 deletions

1
.gitattributes vendored
View File

@ -7916,6 +7916,7 @@ tests/test/tmsg3.pp svneol=native#text/plain
tests/test/tmsg4.pp svneol=native#text/plain
tests/test/tmt1.pp svneol=native#text/plain
tests/test/tobjc1.pp svneol=native#text/plain
tests/test/tobjc2.pp svneol=native#text/plain
tests/test/tobject1.pp svneol=native#text/plain
tests/test/tobject2.pp svneol=native#text/plain
tests/test/tobject3.pp svneol=native#text/plain

View File

@ -1121,6 +1121,12 @@ implementation
begin
doconv:=tc_equal;
eq:=te_convert_l2;
end
else if is_objcclass(def_from) and
(def_to=objc_idtype) then
begin
doconv:=tc_equal;
eq:=te_convert_l1;
end;
end;
end;
@ -1282,7 +1288,14 @@ implementation
doconv:=tc_int_2_int;
eq:=te_convert_l1;
end;
end;
end
else if is_objcclass(def_to) and
(def_from=objc_idtype) then
begin
{ All Objective-C classes are compatible with ID }
doconv:=tc_equal;
eq:=te_convert_l1;
end;
end;
classrefdef :

14
tests/test/tobjc2.pp Normal file
View File

@ -0,0 +1,14 @@
{ %target=darwin}
{ %cpu=powerpc,i386}
{ %norun }
{$mode objfpc}
{$modeswitch objectivec1}
var
a: NSObject;
b: id;
begin
a:=b;
b:=a;
end.