From de15c0057e0590b97a4a1d693c6eccb45fda7d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 22 Jan 2025 21:44:17 +0100 Subject: [PATCH] Simplify implicit exception type handling We generate context during kind inference so generated row variables for exceptions don't need to be explicitly pushed to the context. --- src/type_checker.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/type_checker.rs b/src/type_checker.rs index 29956ef..610aeb1 100644 --- a/src/type_checker.rs +++ b/src/type_checker.rs @@ -89,7 +89,6 @@ fn add_exception_types(module: &mut ast::Module) { loc: ast::Loc::dummy(), }); } else { - fun.sig.type_params.push(row_type_param()); fun.sig.exceptions = Some(exn_type()); } } @@ -101,7 +100,6 @@ fn add_exception_types(module: &mut ast::Module) { ast::TraitDeclItem::AssocTy(_) => {} ast::TraitDeclItem::Fun(fun) => { if fun.sig.exceptions.is_none() { - fun.sig.type_params.push(row_type_param()); fun.sig.exceptions = Some(exn_type()); } } @@ -115,7 +113,6 @@ fn add_exception_types(module: &mut ast::Module) { ast::ImplDeclItem::AssocTy(_) => {} ast::ImplDeclItem::Fun(fun) => { if fun.sig.exceptions.is_none() { - fun.sig.type_params.push(row_type_param()); fun.sig.exceptions = Some(exn_type()); } } @@ -128,17 +125,6 @@ fn add_exception_types(module: &mut ast::Module) { } } -// The row variable in the added exception type: `?exn` in `[..?exn]`. -fn row_type_param() -> ast::TypeParam { - ast::TypeParam { - id: ast::L { - loc: ast::Loc::dummy(), - node: EXN_QVAR_ID.clone(), - }, - bounds: Default::default(), - } -} - // The default exception type: `[..?exn]`. fn exn_type() -> ast::L { ast::L {