core: Minor formatting cleanup

This commit is contained in:
David Mak 2023-12-13 18:15:22 +08:00
parent a19f1065e3
commit b47ac1b89b
4 changed files with 15 additions and 17 deletions

View File

@ -1064,7 +1064,6 @@ impl InnerResolver {
impl SymbolResolver for Resolver { impl SymbolResolver for Resolver {
fn get_default_param_value(&self, expr: &ast::Expr) -> Option<SymbolValue> { fn get_default_param_value(&self, expr: &ast::Expr) -> Option<SymbolValue> {
let ast::ExprKind::Name { id, .. } = &expr.node else { let ast::ExprKind::Name { id, .. } = &expr.node else {
unreachable!("only for resolving names") unreachable!("only for resolving names")
}; };

View File

@ -1634,7 +1634,7 @@ pub fn gen_expr<'ctx, G: CodeGenerator>(
let ty = func.custom.unwrap(); let ty = func.custom.unwrap();
let TypeEnum::TFunc(sign) = &*ctx.unifier.get_ty(ty) else { let TypeEnum::TFunc(sign) = &*ctx.unifier.get_ty(ty) else {
unreachable!() unreachable!()
}; };
sign.clone() sign.clone()
}; };

View File

@ -596,11 +596,10 @@ pub fn exn_constructor<'ctx>(
let zelf = zelf.to_basic_value_enum(ctx, generator, zelf_ty)?.into_pointer_value(); let zelf = zelf.to_basic_value_enum(ctx, generator, zelf_ty)?.into_pointer_value();
let int32 = ctx.ctx.i32_type(); let int32 = ctx.ctx.i32_type();
let zero = int32.const_zero(); let zero = int32.const_zero();
let zelf_id = { let zelf_id = if let TypeEnum::TObj { obj_id, .. } = &*ctx.unifier.get_ty(zelf_ty) {
let TypeEnum::TObj { obj_id, .. } = &*ctx.unifier.get_ty(zelf_ty) else {
unreachable!()
};
obj_id.0 obj_id.0
} else {
unreachable!()
}; };
let defs = ctx.top_level.definitions.read(); let defs = ctx.top_level.definitions.read();
let def = defs[zelf_id].read(); let def = defs[zelf_id].read();

View File

@ -390,17 +390,17 @@ pub fn get_type_from_type_annotation_kinds(
])) ]))
} }
let param_ty = params let param_ty = params
.iter() .iter()
.map(|x| { .map(|x| {
get_type_from_type_annotation_kinds( get_type_from_type_annotation_kinds(
top_level_defs, top_level_defs,
unifier, unifier,
x, x,
subst_list subst_list
) )
}) })
.collect::<Result<Vec<_>, _>>()?; .collect::<Result<Vec<_>, _>>()?;
let subst = { let subst = {
// check for compatible range // check for compatible range