-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
Description
Importing CDQI >= 4.0 into a compilation unit has an unfortunate and very annoying side effect. When complex boolean expressions are used with types supported by CDQI, the compiler thinks these are trying to create NSPredicates rather than Bools. For example:
// This code works just fine:
let x = 3
if x > 0 {
/* blah blah */
}
// This code does not:
if (x > 0) || (x < -44) {
/* blah blah */
}The compiler thinks we are trying to create an instance of NSPredicate in the second if statement. This is a pretty serious bug, although interestingly I have several large codebases that use CDQI and only encountered this in one place.
The solution is to require that the LHS of a CDQI expression that generates an NSPredicate be an instance of an Attribute subclass.