Skip to content

Commit

Permalink
refactor(sol-hir): remove error cases
Browse files Browse the repository at this point in the history
  • Loading branch information
aripiprazole committed Mar 4, 2024
1 parent 6f9a582 commit c4ed8ce
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 21 deletions.
4 changes: 0 additions & 4 deletions sol-eval/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ pub fn hir_eval(
Using(_) => todo!(),
Command(_) => todo!(),
BindingGroup(_) => todo!(),
ClassDecl(_) => todo!(),
InstanceDecl(_) => todo!(),
TraitDecl(_) => todo!(),
Inductive(_) => todo!(),
TypeDecl(_) => todo!(),
}
}
todo!()
Expand Down
10 changes: 5 additions & 5 deletions sol-hir-lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ use sol_hir::{
expr::{AbsExpr, AnnExpr, CallExpr, CallKind, Callee, Expr},
pattern::{BindingPattern, Pattern},
top_level::{
BindingGroup, ClassDecl, Clause, CommandTopLevel, Constructor, ConstructorKind,
Inductive, InstanceDecl, Signature, TopLevel, TraitDecl, TypeDecl, UsingTopLevel,
BindingGroup, Clause, CommandTopLevel, Constructor, ConstructorKind, Inductive,
Signature, TopLevel, UsingTopLevel,
},
type_rep::{AppTypeRep, ArrowKind, ArrowTypeRep, TypeRep},
DefaultWithDb, HirPath, HirSource, Identifier, Location, OptionExt, Spanned,
Expand All @@ -54,7 +54,7 @@ pub trait HirLoweringDb: HirDb + DbWithJar<Jar> {}
impl<T> HirLoweringDb for T where T: HirDb + DbWithJar<Jar> {}

#[rustfmt::skip]
type SyntaxDecl<'tree> = sol_syntax::anon_unions::ClassDecl_Clause_Command_DataDecl_InstanceDecl_Signature_TraitDecl_TypeDecl_Using<'tree>;
type SyntaxDecl<'tree> = sol_syntax::anon_unions::Clause_Command_Inductive_Signature_Using<'tree>;

#[rustfmt::skip]
type SyntaxIdentifier<'tree> = sol_syntax::anon_unions::SimpleIdentifier_SymbolIdentifier<'tree>;
Expand Down Expand Up @@ -303,7 +303,7 @@ impl<'db, 'tree> HirLowering<'db, 'tree> {
let type_rep = tree
.clause_type()
.flatten()
.map(|node| this.clause_type(node))
.map(|node| this.type_expr(node))
.unwrap_or_default_with_db(db);

// Solve the variants within the current scope
Expand Down Expand Up @@ -534,7 +534,7 @@ impl<'db, 'tree> HirLowering<'db, 'tree> {
let type_rep = tree
.clause_type()
.flatten()
.map(|node| this.clause_type(node))
.map(|node| this.type_expr(node))
.unwrap_or_default_with_db(db);

let signature = Signature::new(
Expand Down
8 changes: 0 additions & 8 deletions sol-hir-lowering/src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ type SyntaxExpr<'tree> = sol_syntax::anon_unions::AnnExpr_AppExpr_BinaryExpr_For
type SyntaxTypeRep<'tree> = sol_syntax::anon_unions::AnnExpr_BinaryExpr_ForallExpr_LamExpr_MatchExpr_PiExpr_Primary_SigmaExpr_TypeAppExpr<'tree>;

impl HirLowering<'_, '_> {
/// Resolves a clause type for GADTs, and other things that are not expressions but are
/// type level expressions.
pub fn clause_type(&mut self, clause: sol_syntax::ClauseType) -> TypeRep {
clause
.clause_type()
.solve(self, |this, node| this.type_expr(node))
}

/// Resolves a type level expression.
///
/// It does use the type level of expressions to resolve syntax
Expand Down
4 changes: 0 additions & 4 deletions sol-js/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ pub fn transform_top_level(
generator: false,
is_async: false,
}))),
TopLevel::ClassDecl(_) => bail!("class declarations are not supported"),
TopLevel::InstanceDecl(_) => bail!("instance declarations are not supported"),
TopLevel::TraitDecl(_) => bail!("trait declarations are not supported"),
TopLevel::Inductive(_) => bail!("data declarations are not supported"),
TopLevel::TypeDecl(_) => bail!("type declarations are not supported"),
}
}

Expand Down
1 change: 1 addition & 0 deletions sol-syntax/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(trait_upcasting)]
#![allow(incomplete_features)]

#[allow(clippy::all)]
#[allow(unused_variables)]
Expand Down

0 comments on commit c4ed8ce

Please sign in to comment.