ObjC operator overload fails type checking for protocol
Original Reporter info from Mantis: ryan_joseph @genericptr
-
Reporter name: Ryan Joseph
Original Reporter info from Mantis: ryan_joseph @genericptr
- Reporter name: Ryan Joseph
Description:
The operator overload should cast CFStringRef as a NSString which in turn should be compatible with NSCopyingProtocol. Casting to NSString directly is valid so the operator overload should also work.
Steps to reproduce:
{$mode objfpc}
{$modeswitch objectivec1}
program test;
uses
CocoaAll, MacOSAll;
operator := (right: CFStringRef): NSString;
begin
result := NSString(right);
end;
var
options: NSMutableDictionary;
key: CFStringRef;
begin
key := CFSTR('KEY');
options := NSMutableDictionary.alloc.init;
// Incompatible type for arg no. 2: Got "CFStringRef", expected "NSCopyingProtocol"
options.setObject_forKey(nil, key);
end.
Mantis conversion info:
- Mantis ID: 36333
- Version: 3.3.1