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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitted by:  T.Somequare <tsomeqdev>
Submitted on:  Wed 20 Oct 2010 07:32:00 AM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: Closed

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>
Project 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>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 20 Oct 2010 08:20:23 AM UTCCaSStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1