Skip to content

Complex boolean expressions #40

@Revolucent

Description

@Revolucent

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions