sql-typechecker 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/cli.js +18 -23
- package/out/cli.js.map +2 -2
- package/package.json +1 -1
package/out/cli.js
CHANGED
|
@@ -241712,9 +241712,8 @@ function requireBoolean(e, t) {
|
|
|
241712
241712
|
} else {
|
|
241713
241713
|
throw new TypeMismatch(e, {
|
|
241714
241714
|
expected: BuiltinTypes.Boolean,
|
|
241715
|
-
actual: t
|
|
241716
|
-
|
|
241717
|
-
});
|
|
241715
|
+
actual: t
|
|
241716
|
+
}, "Requiring boolean");
|
|
241718
241717
|
}
|
|
241719
241718
|
}
|
|
241720
241719
|
var BuiltinTypeConstructors = {
|
|
@@ -241798,11 +241797,11 @@ function unifyRecords(e, source, target) {
|
|
|
241798
241797
|
}
|
|
241799
241798
|
const newFields = source.fields.map((sf, i) => {
|
|
241800
241799
|
const tf = target.fields[i];
|
|
241801
|
-
const t = unifySimples(tf.
|
|
241800
|
+
const t = unifySimples(tf._expr || e, sf.type, tf.type);
|
|
241802
241801
|
return {
|
|
241803
241802
|
name: sf.name || tf.name,
|
|
241804
241803
|
type: t,
|
|
241805
|
-
|
|
241804
|
+
_expr: tf._expr
|
|
241806
241805
|
};
|
|
241807
241806
|
});
|
|
241808
241807
|
return {
|
|
@@ -241978,11 +241977,7 @@ function doCreateTable(g, s) {
|
|
|
241978
241977
|
} else {
|
|
241979
241978
|
return acc.concat({
|
|
241980
241979
|
name: c.name,
|
|
241981
|
-
type: mkType(c.dataType, c.constraints || [])
|
|
241982
|
-
expr: {
|
|
241983
|
-
type: "null",
|
|
241984
|
-
_location: c._location
|
|
241985
|
-
}
|
|
241980
|
+
type: mkType(c.dataType, c.constraints || [])
|
|
241986
241981
|
});
|
|
241987
241982
|
}
|
|
241988
241983
|
}, []);
|
|
@@ -242057,7 +242052,7 @@ function elabSelect(g, c, s) {
|
|
|
242057
242052
|
const foundNullabilityInference = inferredNullability.find((inf) => eqQNames(inf.fromName, fr.name) && inf.fieldName === fi.name?.name);
|
|
242058
242053
|
if (foundNullabilityInference && isNullable(fi.type)) {
|
|
242059
242054
|
const t = foundNullabilityInference.isNull === true ? BuiltinTypes.Null : unnullify(fi.type);
|
|
242060
|
-
return {name: fi.name, type: t,
|
|
242055
|
+
return {name: fi.name, type: t, _expr: fi._expr};
|
|
242061
242056
|
} else {
|
|
242062
242057
|
return fi;
|
|
242063
242058
|
}
|
|
@@ -242087,7 +242082,7 @@ function elabSelect(g, c, s) {
|
|
|
242087
242082
|
if (c2.expr.type === "ref" && c2.expr.name === "*") {
|
|
242088
242083
|
return t.fields;
|
|
242089
242084
|
} else {
|
|
242090
|
-
return [{name: n, type: t.fields[0].type,
|
|
242085
|
+
return [{name: n, type: t.fields[0].type, _expr: c2.expr}];
|
|
242091
242086
|
}
|
|
242092
242087
|
} else {
|
|
242093
242088
|
if (c2.expr.type === "ref" && c2.expr.name === "*") {
|
|
@@ -242097,7 +242092,7 @@ function elabSelect(g, c, s) {
|
|
|
242097
242092
|
}
|
|
242098
242093
|
}
|
|
242099
242094
|
}
|
|
242100
|
-
return [{name: n, type: t,
|
|
242095
|
+
return [{name: n, type: t, _expr: c2.expr}];
|
|
242101
242096
|
});
|
|
242102
242097
|
return {
|
|
242103
242098
|
kind: "record",
|
|
@@ -242121,7 +242116,7 @@ function elabSelect(g, c, s) {
|
|
|
242121
242116
|
if (t === null) {
|
|
242122
242117
|
throw new CantReduceToSimpleT(exp, t_);
|
|
242123
242118
|
} else {
|
|
242124
|
-
return {name: null, type: t,
|
|
242119
|
+
return {name: null, type: t, _expr: exp};
|
|
242125
242120
|
}
|
|
242126
242121
|
});
|
|
242127
242122
|
return {
|
|
@@ -242149,7 +242144,7 @@ function elabSelect(g, c, s) {
|
|
|
242149
242144
|
{
|
|
242150
242145
|
name: null,
|
|
242151
242146
|
type: res,
|
|
242152
|
-
|
|
242147
|
+
_expr: s
|
|
242153
242148
|
}
|
|
242154
242149
|
]
|
|
242155
242150
|
};
|
|
@@ -242163,6 +242158,7 @@ function elabSelect(g, c, s) {
|
|
|
242163
242158
|
}
|
|
242164
242159
|
}
|
|
242165
242160
|
function elabInsert(g, c, s) {
|
|
242161
|
+
debugger;
|
|
242166
242162
|
const insertingInto = g.tables.find((t) => eqQNames(t.name, s.into)) || null;
|
|
242167
242163
|
if (!insertingInto) {
|
|
242168
242164
|
throw new UnknownIdentifier(s, s.into);
|
|
@@ -242187,7 +242183,7 @@ function elabInsert(g, c, s) {
|
|
|
242187
242183
|
}
|
|
242188
242184
|
return foundField;
|
|
242189
242185
|
}) : insertingInto.rel.fields;
|
|
242190
|
-
const insertT = elabSelect(g,
|
|
242186
|
+
const insertT = elabSelect(g, c, s.insert);
|
|
242191
242187
|
if (insertT.kind === "void") {
|
|
242192
242188
|
throw new ColumnsMismatch(s.insert, {
|
|
242193
242189
|
expected: columns.length,
|
|
@@ -242202,7 +242198,7 @@ function elabInsert(g, c, s) {
|
|
|
242202
242198
|
}
|
|
242203
242199
|
insertT.fields.forEach((insertField, i) => {
|
|
242204
242200
|
const col = columns[i];
|
|
242205
|
-
cast(insertField.
|
|
242201
|
+
cast(insertField._expr || s.insert, insertField.type, col.type, "assignment");
|
|
242206
242202
|
});
|
|
242207
242203
|
if (s.returning) {
|
|
242208
242204
|
return {
|
|
@@ -242216,7 +242212,7 @@ function elabInsert(g, c, s) {
|
|
|
242216
242212
|
return {
|
|
242217
242213
|
name: selectedCol.alias || deriveNameFromExpr(selectedCol.expr),
|
|
242218
242214
|
type: t,
|
|
242219
|
-
|
|
242215
|
+
_expr: selectedCol.expr
|
|
242220
242216
|
};
|
|
242221
242217
|
}
|
|
242222
242218
|
})
|
|
@@ -242255,7 +242251,7 @@ function elabDeleteOrUpdate(g, c, s) {
|
|
|
242255
242251
|
return {
|
|
242256
242252
|
name: selectedCol.alias || deriveNameFromExpr(selectedCol.expr),
|
|
242257
242253
|
type: t,
|
|
242258
|
-
|
|
242254
|
+
_expr: selectedCol.expr
|
|
242259
242255
|
};
|
|
242260
242256
|
}
|
|
242261
242257
|
})
|
|
@@ -242851,7 +242847,7 @@ function elabCall(g, c, e) {
|
|
|
242851
242847
|
record.fields.push({
|
|
242852
242848
|
name: {name: key.value},
|
|
242853
242849
|
type: valTSimple,
|
|
242854
|
-
|
|
242850
|
+
_expr: e.args[i]
|
|
242855
242851
|
});
|
|
242856
242852
|
}
|
|
242857
242853
|
return {kind: "jsonknown", record};
|
|
@@ -243058,9 +243054,8 @@ function elabExpr(g, c, e) {
|
|
|
243058
243054
|
if (unnulified.kind !== "array") {
|
|
243059
243055
|
throw new TypeMismatch(e.array, {
|
|
243060
243056
|
expected: arrayT,
|
|
243061
|
-
actual: BuiltinTypeConstructors.Array(BuiltinTypes.AnyScalar)
|
|
243062
|
-
|
|
243063
|
-
});
|
|
243057
|
+
actual: BuiltinTypeConstructors.Array(BuiltinTypes.AnyScalar)
|
|
243058
|
+
}, "Can't get array index from non-array type");
|
|
243064
243059
|
} else {
|
|
243065
243060
|
return nullify(unnulified.typevar);
|
|
243066
243061
|
}
|