bugGNUstep - Bugs: bug #31381, The NSPredicate class using...

Group
 
 

bug #31381: The NSPredicate class using Keyword `SELF` does not work correctly.

Submitter:  T.Somequare <tsomeqdev>
Submitted:  Wed 20 Oct 2010 07:32:00 AM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 20 Oct 2010 08:20:23 AM UTC, comment #1: 

Thanks ... but I think you will find this is already fixed/working in svn trunk.

Richard Frith-Macdonald <CaS>
Group Member
Wed 20 Oct 2010 07:32:00 AM UTC, original submission:  

I am afraid there is a bug in the NSPredicate class.
The expected result of exec below is output of "1", but actual result is "0".
--
 NSString* fmt = @"SELF == 'aaa'";
 NSPredicate* predicate    = [NSPredicate predicateWithFormat:fmt] ;
 BOOL ok = [predicate evaluateWithObject:@"aaa"];
 NSLog(@"[predicate evaluateWithObject:@\"aaa\"] -> %d", ok);
--

I think the problem is in :
 File: NSPredicate.m
 Implementation GSEvaluatedObjectExpression
 Method -(id)expressionValueWithObject:(id)obj context:(NSDictionary*)info  


Index: NSPredicate.m
=============================================
--- NSPredicate.m (revision 30789)
+++ NSPredicate.m (working copy)

@@ -1174,7 +1174,7 @@
 - (id) expressionValueWithObject: (id)object
                         context: (NSMutableDictionary *)context
 {
-  return object;
+  return self;
 }

=====================


T.Somequare <tsomeqdev>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by tsomeqdev (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-10-20 CaS StatusNone Invalid
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code