Skip to content

Commit

Permalink
refactor: Fix nightly lint (#4738)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty authored Jul 15, 2024
1 parent a33af91 commit c58fb33
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lutra/lutra/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn parse_and_compile(source_tree: &SourceTree) -> Result<ProjectCompiled, ErrorM

// parse and resolve
let ast_tree = prqlc::prql_to_pl_tree(source_tree)?;
let mut root_module = semantic::resolve(ast_tree, Default::default())?;
let mut root_module = semantic::resolve(ast_tree)?;

// find the database module
let database_module = find_database_module(&mut root_module)?;
Expand Down
2 changes: 1 addition & 1 deletion prqlc/prqlc/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ impl Command {
let root_mod = prql_to_pl(&source)?;

// resolve
let ctx = semantic::resolve(root_mod, Default::default())?;
let ctx = semantic::resolve(root_mod)?;

let frames = if let Ok((main, _)) = ctx.find_main_rel(&[]) {
semantic::reporting::collect_frames(*main.clone().into_relation_var().unwrap())
Expand Down
2 changes: 1 addition & 1 deletion prqlc/prqlc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ pub mod internal {
) -> Result<semantic::reporting::FrameCollector, ErrorMessages> {
let ast = Some(pl.clone());

let root_module = semantic::resolve(pl, Default::default()).map_err(ErrorMessages::from)?;
let root_module = semantic::resolve(pl).map_err(ErrorMessages::from)?;

let (main, _) = root_module.find_main_rel(&[]).unwrap();
let mut fc =
Expand Down
10 changes: 5 additions & 5 deletions prqlc/prqlc/src/semantic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn resolve_and_lower(
main_path: &[String],
database_module_path: Option<&[String]>,
) -> Result<RelationalQuery> {
let root_mod = resolve(file_tree, Default::default())?;
let root_mod = resolve(file_tree)?;

debug::log_stage(debug::Stage::Semantic(debug::StageSemantic::Lowering));
let default_db = [NS_DEFAULT_DB.to_string()];
Expand All @@ -40,7 +40,7 @@ pub fn resolve_and_lower(
}

/// Runs semantic analysis on the query.
pub fn resolve(mut module_tree: pr::ModuleDef, options: ResolverOptions) -> Result<RootModule> {
pub fn resolve(mut module_tree: pr::ModuleDef) -> Result<RootModule> {
load_std_lib(&mut module_tree);

// expand AST into PL
Expand All @@ -53,7 +53,7 @@ pub fn resolve(mut module_tree: pr::ModuleDef, options: ResolverOptions) -> Resu
module: Module::new_root(),
..Default::default()
};
let mut resolver = Resolver::new(&mut root_module, options);
let mut resolver = Resolver::new(&mut root_module);

// resolve the module def into the root module
debug::log_stage(debug::Stage::Semantic(debug::StageSemantic::Resolver));
Expand Down Expand Up @@ -86,7 +86,7 @@ pub fn load_std_lib(module_tree: &mut pr::ModuleDef) {
}

pub fn static_eval(expr: Expr, root_mod: &mut RootModule) -> Result<ConstExpr> {
let mut resolver = Resolver::new(root_mod, ResolverOptions::default());
let mut resolver = Resolver::new(root_mod);

resolver.static_eval_to_constant(expr)
}
Expand Down Expand Up @@ -183,7 +183,7 @@ pub mod test {

pub fn parse_and_resolve(query: &str) -> Result<RootModule, Errors> {
let source_tree = query.into();
Ok(resolve(parse(&source_tree)?, Default::default())?)
Ok(resolve(parse(&source_tree)?)?)
}

#[test]
Expand Down
5 changes: 1 addition & 4 deletions prqlc/prqlc/src/semantic/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,16 @@ pub struct Resolver<'a> {

pub id: IdGenerator<usize>,

pub options: ResolverOptions,

pub generics: HashMap<(usize, String), Vec<crate::pr::Ty>>,
}

#[derive(Default, Clone)]
pub struct ResolverOptions {}

impl Resolver<'_> {
pub fn new(root_mod: &mut RootModule, options: ResolverOptions) -> Resolver {
pub fn new(root_mod: &mut RootModule) -> Resolver {
Resolver {
root_mod,
options,
current_module_path: Vec::new(),
default_namespace: None,
in_func_call_name: false,
Expand Down
3 changes: 1 addition & 2 deletions prqlc/prqlc/src/sql/operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ fn std() -> &'static decl::Module {
None,
);
let ast = crate::parser::parse(&std_lib).unwrap();
let options = semantic::ResolverOptions {};
let context = semantic::resolve(ast, options).unwrap();
let context = semantic::resolve(ast).unwrap();

context.module
})
Expand Down
3 changes: 0 additions & 3 deletions prqlc/prqlc/src/sql/pq/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ pub enum RelationStatus {

#[derive(Debug)]
pub struct RelationInstance {
pub riid: RIId,

pub table_ref: TableRef,

/// When a pipeline is split, [CId]s from first pipeline are assigned a new
Expand Down Expand Up @@ -169,7 +167,6 @@ impl AnchorContext {

let original_cids = table_ref.columns.iter().map(|(_, c)| *c).collect();
let relation_instance = RelationInstance {
riid,
table_ref,
cid_redirects,
original_cids,
Expand Down
2 changes: 1 addition & 1 deletion prqlc/prqlc/tests/integration/resolving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn resolve(prql_source: &str) -> Result<String, ErrorMessages> {
let sources = prqlc::SourceTree::single("".into(), prql_source.to_string());
let stmts = prqlc::prql_to_pl_tree(&sources)?;

let root_module = prqlc::semantic::resolve(stmts, Default::default())
let root_module = prqlc::semantic::resolve(stmts)
.map_err(|e| prqlc::ErrorMessages::from(e).composed(&sources))?;

// resolved PL, restricted back into AST
Expand Down

0 comments on commit c58fb33

Please sign in to comment.