haxe-objc-target
haxe-objc-target copied to clipboard
String equality is broken
All strings are separate copies, so '==' checks break.
e.g.,
private function test() {
var x = "hello";
var t = (x == "hello");
return t ? "Good" : "Bad";
}
generates this Objective-C:
- (NSMutableString*) test{
NSMutableString *x = [@"hello" mutableCopy];
BOOL t = x == [@"hello" mutableCopy];
return ( (t) ? [@"Good" mutableCopy] : [@"Bad" mutableCopy]);
}
i.e., it returns Bad, because both instances of "hello" are separate copies, and '==' is false.
The fix for this would either be string interning, or using NSString.isEqualToString.