Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compilable code is generated for nullable argument #2379

Closed
miraslau opened this issue May 6, 2021 · 0 comments · Fixed by #2819
Closed

Not compilable code is generated for nullable argument #2379

miraslau opened this issue May 6, 2021 · 0 comments · Fixed by #2819

Comments

@miraslau
Copy link

miraslau commented May 6, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants