mirror of https://github.com/AMT-Cheif/drift.git
Fix `CAST` always being non-nullable
This commit is contained in:
parent
d9072d7fac
commit
4b83810a17
|
@ -434,7 +434,7 @@ class TypeResolver extends RecursiveVisitor<TypeExpectation, void> {
|
|||
@override
|
||||
void visitCastExpression(CastExpression e, TypeExpectation arg) {
|
||||
final type = session.context.schemaSupport.resolveColumnType(e.typeName);
|
||||
session._checkAndResolve(e, type, arg);
|
||||
session._checkAndResolve(e, type.withoutNullabilityInfo, arg);
|
||||
session._addRelation(NullableIfSomeOtherIs(e, [e.operand]));
|
||||
visit(e.operand, const NoTypeExpectation());
|
||||
}
|
||||
|
|
|
@ -58,6 +58,10 @@ const Map<String, ResolvedType?> _types = {
|
|||
ResolvedType(type: BasicType.int, nullable: true, hint: IsDateTime()),
|
||||
"SELECT datetime('now') = ?":
|
||||
ResolvedType(type: BasicType.text, nullable: true, hint: IsDateTime()),
|
||||
'SELECT CAST(NULLIF(1, 2) AS INTEGER) = ?': ResolvedType(
|
||||
type: BasicType.int,
|
||||
nullable: true,
|
||||
),
|
||||
};
|
||||
|
||||
SqlEngine _spawnEngine() {
|
||||
|
|
Loading…
Reference in New Issue