Skip to content

Not compilable code is generated for nullable argument #2379

@miraslau

Description

@miraslau

Build Environment
SQLDelight version: 1.5.0
OS: Android
Gradle version: 6.8.3
Kotlin version: 1.5.0
AGP Version (if applicable): 4.2.0

Just try to compile this:

CREATE TABLE sample (
    id INTEGER PRIMARY KEY,
    string TEXT,
    integer INTEGER
);

query:
SELECT * FROM sample
WHERE
    (:someInteger IS NULL) OR (
        (string = :someString) AND (integer >= :someInteger)
    );

It will generate not-compilable code:

e: Type mismatch: inferred type is String? but Long? was expected
e: Type mismatch: inferred type is Long? but String? was expected

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions