sql-typechecker 0.0.29 → 0.0.30
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 +11 -9
- package/out/cli.js.map +2 -2
- package/package.json +1 -1
package/out/cli.js
CHANGED
|
@@ -241712,7 +241712,8 @@ function requireBoolean(e, t) {
|
|
|
241712
241712
|
} else {
|
|
241713
241713
|
throw new TypeMismatch(e, {
|
|
241714
241714
|
expected: BuiltinTypes.Boolean,
|
|
241715
|
-
actual: t
|
|
241715
|
+
actual: t,
|
|
241716
|
+
mess: "Requiring boolean"
|
|
241716
241717
|
});
|
|
241717
241718
|
}
|
|
241718
241719
|
}
|
|
@@ -241784,7 +241785,7 @@ function cast(e, source, target, casttype) {
|
|
|
241784
241785
|
}
|
|
241785
241786
|
function castRecords(e, source, target, casttype) {
|
|
241786
241787
|
if (source.fields.length !== target.fields.length) {
|
|
241787
|
-
throw new TypeMismatch(e, {expected: source, actual: target});
|
|
241788
|
+
throw new TypeMismatch(e, {expected: source, actual: target}, "Amount of fields is not the same");
|
|
241788
241789
|
}
|
|
241789
241790
|
source.fields.forEach((sf, i) => {
|
|
241790
241791
|
const tf = target.fields[i];
|
|
@@ -241793,7 +241794,7 @@ function castRecords(e, source, target, casttype) {
|
|
|
241793
241794
|
}
|
|
241794
241795
|
function unifyRecords(e, source, target) {
|
|
241795
241796
|
if (source.fields.length !== target.fields.length) {
|
|
241796
|
-
throw new TypeMismatch(e, {expected: source, actual: target});
|
|
241797
|
+
throw new TypeMismatch(e, {expected: source, actual: target}, "Amount of fields is not the same");
|
|
241797
241798
|
}
|
|
241798
241799
|
const newFields = source.fields.map((sf, i) => {
|
|
241799
241800
|
const tf = target.fields[i];
|
|
@@ -241846,19 +241847,19 @@ function castSimples(e, source, target, type) {
|
|
|
241846
241847
|
if (target.kind === "nullable") {
|
|
241847
241848
|
return castSimples(e, source.typevar, target.typevar, type);
|
|
241848
241849
|
} else {
|
|
241849
|
-
throw new TypeMismatch(e, {expected: source, actual: target});
|
|
241850
|
+
throw new TypeMismatch(e, {expected: source, actual: target}, "Nullability is different");
|
|
241850
241851
|
}
|
|
241851
241852
|
} else if (source.kind === "array") {
|
|
241852
241853
|
if (target.kind === "array" && source.subtype === target.subtype) {
|
|
241853
241854
|
return castSimples(e, source.typevar, target.typevar, type);
|
|
241854
241855
|
} else {
|
|
241855
|
-
throw new TypeMismatch(e, {expected: source, actual: target});
|
|
241856
|
+
throw new TypeMismatch(e, {expected: source, actual: target}, "Can't unify array with non-array");
|
|
241856
241857
|
}
|
|
241857
241858
|
} else if (source.kind === "scalar") {
|
|
241858
241859
|
if (target.kind === "scalar") {
|
|
241859
241860
|
return castScalars(e, source, target, type);
|
|
241860
241861
|
} else {
|
|
241861
|
-
throw new TypeMismatch(e, {expected: source, actual: target});
|
|
241862
|
+
throw new TypeMismatch(e, {expected: source, actual: target}, "Can't unify scalar with non-scalar");
|
|
241862
241863
|
}
|
|
241863
241864
|
} else if (source.kind === "jsonknown") {
|
|
241864
241865
|
if (target.kind === "jsonknown") {
|
|
@@ -241872,7 +241873,7 @@ function castSimples(e, source, target, type) {
|
|
|
241872
241873
|
}
|
|
241873
241874
|
return;
|
|
241874
241875
|
} else {
|
|
241875
|
-
throw new TypeMismatch(e, {expected: source, actual: target});
|
|
241876
|
+
throw new TypeMismatch(e, {expected: source, actual: target}, "Can't unify JSON with non-JSON");
|
|
241876
241877
|
}
|
|
241877
241878
|
} else {
|
|
241878
241879
|
return checkAllCasesHandled(source);
|
|
@@ -241915,7 +241916,7 @@ function unifyCallGeneral(call, argTypes, expectedArgs, returnT) {
|
|
|
241915
241916
|
function castScalars(e, source, target, type) {
|
|
241916
241917
|
const matchingCast = findMatchingCast([source.name], source, target, type);
|
|
241917
241918
|
if (matchingCast === null) {
|
|
241918
|
-
throw new TypeMismatch(e, {expected: target, actual: source});
|
|
241919
|
+
throw new TypeMismatch(e, {expected: target, actual: source}, "Couldn't find matching cast");
|
|
241919
241920
|
}
|
|
241920
241921
|
}
|
|
241921
241922
|
function findMatchingCast(visited, from, to, type) {
|
|
@@ -243057,7 +243058,8 @@ function elabExpr(g, c, e) {
|
|
|
243057
243058
|
if (unnulified.kind !== "array") {
|
|
243058
243059
|
throw new TypeMismatch(e.array, {
|
|
243059
243060
|
expected: arrayT,
|
|
243060
|
-
actual: BuiltinTypeConstructors.Array(BuiltinTypes.AnyScalar)
|
|
243061
|
+
actual: BuiltinTypeConstructors.Array(BuiltinTypes.AnyScalar),
|
|
243062
|
+
mess: "Can't get array index from non-array type"
|
|
243061
243063
|
});
|
|
243062
243064
|
} else {
|
|
243063
243065
|
return nullify(unnulified.typevar);
|