Skip to content

Commit

Permalink
widen: Keep track of nodes when creating new TypeMap
Browse files Browse the repository at this point in the history
  • Loading branch information
CohenArthur committed Aug 29, 2024
1 parent 4b2534a commit f3185b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions typecheck/src/typemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pub struct TypeRef(pub(crate) OriginIdx); // FIXME: Remove vis?

#[derive(Debug)]
pub struct TypeMap {
nodes: HashMap<OriginIdx, TypeRef>,
// FIXME: Remove?
// FIXME: Remove pub-ability?
pub(crate) nodes: HashMap<OriginIdx, TypeRef>,
pub(crate) types: HashMap<TypeRef, Type>,
}

Expand Down
6 changes: 5 additions & 1 deletion typecheck/src/widen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn widen_inner(
}

pub fn widen(fir: &Fir<FlattenData<'_>>, type_ctx: TypeCtx<TypeMap>) -> TypeCtx<TypeMap> {
let types = type_ctx
let mut types = type_ctx
.types
.types
.iter()
Expand All @@ -48,6 +48,10 @@ pub fn widen(fir: &Fir<FlattenData<'_>>, type_ctx: TypeCtx<TypeMap>) -> TypeCtx<
tymap
});

// Don't forget to keep track of all the nodes that make use of the types
// we just widened
types.nodes = type_ctx.types.nodes;

TypeCtx {
primitives: type_ctx.primitives,
types,
Expand Down

0 comments on commit f3185b3

Please sign in to comment.