recursive types (and operations on them, like pretty-printing, comparison and unification) seem to be working.

big part of the code base still needs to be 'ported' to the updated type constructors.
This commit is contained in:
Joeri Exelmans 2025-05-05 17:17:45 +02:00
parent 55c5d7cffa
commit 8eec5b9239
34 changed files with 523 additions and 295 deletions

View file

@ -6,7 +6,7 @@ import { isFunction } from '../structures/types.js';
import { ModuleStd } from '../stdlib.js';
import { Double, GenericType, Int, SymbolT, Type } from "../primitives/types.js";
import { eqType } from '../primitives/type.js';
import { Any } from "../primitives/types.js";
import { Top } from "../primitives/types.js";
import { assignFn, makeGeneric, onlyOccurring } from '../generics/generics.js';
import { prettyT } from '../util/pretty.js';
@ -48,7 +48,7 @@ class Context {
// console.log(strI, '::', strT);
this.types.getdefault(i, true).add(t);
this.types.getdefault(i, true).add(Any);
this.types.getdefault(i, true).add(Top);
if (t.typeVars) {
// console.log("generic:", prettyT(t));
this.types.getdefault(t, true).add(GenericType);
@ -59,7 +59,7 @@ class Context {
}
this.instances.getdefault(t, true).add(i);
this.instances.getdefault(Any, true).add(i);
this.instances.getdefault(Top, true).add(i);
}
const addIfFunctionType = (t, originalT, add) => {
if (isFunction(t)) {