Skip to content

Commit

Permalink
Simplify implicit exception type handling
Browse files Browse the repository at this point in the history
We generate context during kind inference so generated row variables for
exceptions don't need to be explicitly pushed to the context.
  • Loading branch information
osa1 committed Jan 22, 2025
1 parent 33c03d1 commit de15c00
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/type_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand All @@ -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());
}
}
Expand All @@ -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());
}
}
Expand All @@ -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::Type> {
ast::L {
Expand Down

0 comments on commit de15c00

Please sign in to comment.