diff --git a/lib/generics/unify.js b/lib/generics/unify.js index 8dcff8f..dde60fc 100644 --- a/lib/generics/unify.js +++ b/lib/generics/unify.js @@ -157,7 +157,7 @@ export const unify = (typeA, typeB) => { // A and B are not typevars if (typeA.symbol !== typeB.symbol) { - throw new IncompabibleTypesError(typeA, typeB); + throw new IncompatibleTypesError(typeA, typeB); } const subs = zip(typeA.params, typeB.params) @@ -171,11 +171,11 @@ export const unify = (typeA, typeB) => { } catch (e) { 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 - throw new IncompabibleTypesError(typeA, typeB, e); + throw new IncompatibleTypesError(typeA, typeB, e); } throw e; } diff --git a/tests/unify.js b/tests/unify.js index 588de70..cb72f8e 100644 --- a/tests/unify.js +++ b/tests/unify.js @@ -1,7 +1,7 @@ import assert from "node:assert"; 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) => { @@ -27,7 +27,7 @@ assert.throws( mkType("Bool") ); }, - IncompabibleTypesError, + IncompatibleTypesError, ); assertSubsitutionsEqual( @@ -69,7 +69,7 @@ assert.throws( mkType("[b] -> b"), ); }, - IncompabibleTypesError, + IncompatibleTypesError, ); assertSubsitutionsEqual( @@ -90,7 +90,7 @@ assert.throws( mkType("b -> (c -> b)"), ); }, - IncompabibleTypesError, + IncompatibleTypesError, // String, );