bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #43915] Simple bug in NSCountedSet comparsons


From: Vincent Woo
Subject: [bug #43915] Simple bug in NSCountedSet comparsons
Date: Fri, 02 Jan 2015 15:14:07 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?43915>

                 Summary: Simple bug in NSCountedSet comparsons
                 Project: GNUstep
            Submitted by: akanet
            Submitted on: Fri 02 Jan 2015 03:14:06 PM GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Hey all, this is my first bug report to gnustep-base so please let me know if
I've misstepped in any way.

I've got a very simple and reproducible bug for you today. The following code
should print "false" (as it does in XCode), but prints "true" instead:

   NSCountedSet *set1 = [NSCountedSet setWithArray:@[@1, @1]];
   NSCountedSet *set2 = [NSCountedSet setWithArray:@[@1]];
   BOOL isEqual = [set1 isEqualToSet:set2];
   NSLog(@"%@", isEqual ? @"true" : @"false");

This is because NSCountedSet in GNUStep falls back to the NSSet implementation
of isEqualToSet:

https://github.com/gnustep/base/blob/master/Source/NSSet.m#L596

Which is obviously not using the counts of the number of items in the set.

I am on Ubuntu 14.04 and using the very latest version (HEAD) of GNUStep.

I don't know Objective-C very well, but I imagine isEqualToSet could be
implemented on NSCountedSet that could be count-aware (and cast regular sets
to counted sets with count=1).




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43915>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]