mirror of https://github.com/AMT-Cheif/drift.git
Improve type inference around IS expressions
This commit is contained in:
parent
5db10342b0
commit
efe0df519b
|
@ -338,8 +338,11 @@ class TypeResolver extends RecursiveVisitor<TypeExpectation, void> {
|
|||
|
||||
@override
|
||||
void visitIsExpression(IsExpression e, TypeExpectation arg) {
|
||||
session._checkAndResolve(e, const ResolvedType.bool(), arg);
|
||||
session._hintNullability(e, false);
|
||||
session
|
||||
.._checkAndResolve(e, const ResolvedType.bool(), arg)
|
||||
.._addRelation(HaveSameType(e.left, e.right))
|
||||
.._hintNullability(e, false);
|
||||
|
||||
visitChildren(e, const NoTypeExpectation());
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ const Map<String, ResolvedType?> _types = {
|
|||
'SELECT (3 * 4) = ?': ResolvedType(type: BasicType.int),
|
||||
'SELECT (3 / 4) = ?': ResolvedType(type: BasicType.int),
|
||||
'SELECT (3 / 4.) = ?': ResolvedType(type: BasicType.real),
|
||||
'SELECT NULLIF(3, 3) IS ?': ResolvedType(type: BasicType.int, nullable: true),
|
||||
'SELECT CURRENT_TIMESTAMP = ?': ResolvedType(type: BasicType.text),
|
||||
"SELECT COALESCE(NULL, 'foo') = ?": ResolvedType(type: BasicType.text),
|
||||
'SELECT NULLIF(3, 4) = ?': ResolvedType(type: BasicType.int, nullable: true),
|
||||
|
|
Loading…
Reference in New Issue