Skip to content

Compliation issue regarding nullibility of Long column, after upgrading from 2.0.0 to 2.0.1 #4911

@marcardar

Description

@marcardar

SQLDelight Version

2.0.1

Operating System

Android

Gradle Version

8.2.1

Kotlin Version

1.9.21

Dialect

sqlite-3-38-dialect

AGP Version

8.2.1

Describe the Bug

After upgrading from 2.0.0 to 2.0.1, I get a compilation error.

loadFoo:
SELECT T.*, ifnull(cnt, 0) AS count
FROM t T
LEFT OUTER JOIN (
    SELECT foo_id, count(*) AS cnt
    FROM i I
    GROUP BY foo_id
) ON T.id = foo_id
ORDER BY T.code;
queries.loadFoo { id: Long, code: String, count: Long ->
    ...
}
Type mismatch: inferred type is (Long, String, Long, String?, Long) -> Foo but (Long, String, Long?) -> TypeVariable(T) was expected

So it looks like sqldelight no longer realises that ifNull(..) will always be non-null?

Workaround is to just change to count type to Long?

Stacktrace

No response

Gradle Build Script

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions