typo
This commit is contained in:
parent
0d3ccee7d5
commit
664f31447f
2 changed files with 8 additions and 8 deletions
|
|
@ -157,7 +157,7 @@ export const unify = (typeA, typeB) => {
|
||||||
|
|
||||||
// A and B are not typevars
|
// A and B are not typevars
|
||||||
if (typeA.symbol !== typeB.symbol) {
|
if (typeA.symbol !== typeB.symbol) {
|
||||||
throw new IncompabibleTypesError(typeA, typeB);
|
throw new IncompatibleTypesError(typeA, typeB);
|
||||||
}
|
}
|
||||||
|
|
||||||
const subs = zip(typeA.params, typeB.params)
|
const subs = zip(typeA.params, typeB.params)
|
||||||
|
|
@ -171,11 +171,11 @@ export const unify = (typeA, typeB) => {
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (e instanceof SubstitutionCycle) {
|
if (e instanceof SubstitutionCycle) {
|
||||||
throw new IncompabibleTypesError(typeA, typeB, e);
|
throw new IncompatibleTypesError(typeA, typeB, e);
|
||||||
}
|
}
|
||||||
if (e instanceof IncompabibleTypesError) {
|
if (e instanceof IncompatibleTypesError) {
|
||||||
// nest errors to get a nice trace of what went wrong
|
// nest errors to get a nice trace of what went wrong
|
||||||
throw new IncompabibleTypesError(typeA, typeB, e);
|
throw new IncompatibleTypesError(typeA, typeB, e);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import assert from "node:assert";
|
import assert from "node:assert";
|
||||||
|
|
||||||
import { getDefaultTypeParser } from "../lib/parser/type_parser.js";
|
import { getDefaultTypeParser } from "../lib/parser/type_parser.js";
|
||||||
import { IncompabibleTypesError, subsitutionsEqual, unify } from "../lib/generics/unify.js";
|
import { IncompatibleTypesError, subsitutionsEqual, unify } from "../lib/generics/unify.js";
|
||||||
|
|
||||||
|
|
||||||
const assertSubsitutionsEqual = (m1,m2) => {
|
const assertSubsitutionsEqual = (m1,m2) => {
|
||||||
|
|
@ -27,7 +27,7 @@ assert.throws(
|
||||||
mkType("Bool")
|
mkType("Bool")
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
IncompabibleTypesError,
|
IncompatibleTypesError,
|
||||||
);
|
);
|
||||||
|
|
||||||
assertSubsitutionsEqual(
|
assertSubsitutionsEqual(
|
||||||
|
|
@ -69,7 +69,7 @@ assert.throws(
|
||||||
mkType("[b] -> b"),
|
mkType("[b] -> b"),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
IncompabibleTypesError,
|
IncompatibleTypesError,
|
||||||
);
|
);
|
||||||
|
|
||||||
assertSubsitutionsEqual(
|
assertSubsitutionsEqual(
|
||||||
|
|
@ -90,7 +90,7 @@ assert.throws(
|
||||||
mkType("b -> (c -> b)"),
|
mkType("b -> (c -> b)"),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
IncompabibleTypesError,
|
IncompatibleTypesError,
|
||||||
// String,
|
// String,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue