Skip to content

Commit

Permalink
UnifyError: use GenericParam instead of IrId for scope error
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePuzzlemaker committed Feb 15, 2024
1 parent 7fec496 commit 8f1f5ac
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/typeck/unify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use crate::{
ir::{GenericParam, IrId, MetaEntry, MetaVar, Node, Ty, TyKind},
};

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum UnifyError {
Occurs,
Scope(IrId),
Scope(GenericParam),
SpineMismatch,
RigidMismatch,
}
Expand Down Expand Up @@ -57,7 +57,15 @@ fn rename(
tdat.span,
),
Var(id) => match env.iter().find(|x| x.id == id) {
None => return Err(UnifyError::Scope(id)),
None => {
return Err(UnifyError::Scope({
let Node::GenericParam(param) = gcx.arenas.ir.get_node_by_id(id).unwrap()
else {
unreachable!()
};
param
}))
}
Some(_) => t,
},
Function(args, ret_ty) => {
Expand Down

0 comments on commit 8f1f5ac

Please sign in to comment.