From 8f1f5acd72ab9ece5be345b9499fb0aa13a75e43 Mon Sep 17 00:00:00 2001 From: ThePuzzlemaker Date: Thu, 15 Feb 2024 08:28:10 -0600 Subject: [PATCH] `UnifyError`: use GenericParam instead of IrId for scope error --- src/typeck/unify.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/typeck/unify.rs b/src/typeck/unify.rs index 7c29789..ad23cda 100644 --- a/src/typeck/unify.rs +++ b/src/typeck/unify.rs @@ -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, } @@ -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) => {