Adding more types to my stdlib functions. Cleaning up type checker
This commit is contained in:
parent
850219cdec
commit
2b710602d3
2 changed files with 30 additions and 51 deletions
|
|
@ -32,6 +32,9 @@ function unify(t1: TypeAST, t2: TypeAST, subst: Subst): string | null {
|
|||
// Same type name
|
||||
if (a.kind === 'type-name' && b.kind === 'type-name' && a.name === b.name) return null;
|
||||
|
||||
// Same type var
|
||||
if (a.kind === 'type-var' && b.kind === 'type-var' && a.name === b.name) return null;
|
||||
|
||||
// Type var binds to anything
|
||||
if (a.kind === 'type-var') {
|
||||
if (occursIn(a.name, b, subst)) return `Infinite type: ${a.name} occurs in ${prettyPrintType(b)}`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue