Fix loads of warnings

This commit is contained in:
Sofia 2025-08-05 22:00:11 +03:00
parent 67106ea17b
commit c84954480b
11 changed files with 17 additions and 33 deletions

View File

@ -1,8 +1,7 @@
use std::{collections::HashMap, fmt::format, hash::Hash, path::PathBuf};
use std::{collections::HashMap, hash::Hash, path::PathBuf};
use reid::{
ast::{
self, FunctionDefinition,
lexer::{FullToken, Token},
token_stream::TokenRange,
},

View File

@ -1,7 +1,7 @@
//! This is the module that contains relevant code to parsing Reid, that is to
//! say transforming a Vec of FullTokens into a loose parsed AST that can be
//! used for unwrapping syntax sugar, and then be transformed into Reid MIR.
use std::{fs::Metadata, path::PathBuf};
use std::path::PathBuf;
use token_stream::TokenRange;

View File

@ -5,7 +5,7 @@ use reid_lib::{
Block, Instr,
};
use mir::{CustomTypeKey, FunctionCall, FunctionDefinitionKind, IfExpression, TypeKind, WhileStatement};
use mir::{CustomTypeKey, FunctionDefinitionKind, IfExpression, TypeKind, WhileStatement};
use crate::mir::{self, FunctionParam, Metadata, SourceModuleId};

View File

@ -67,7 +67,7 @@ impl mir::Context {
}
for module in &modules_sorted {
let codegen = module.codegen(context, modules.clone())?;
module.codegen(context, modules.clone())?;
}
Ok(CodegenContext { context })
}
@ -75,7 +75,6 @@ impl mir::Context {
#[derive(Clone)]
struct ModuleCodegen<'ctx> {
name: String,
module: Module<'ctx>,
}
@ -596,10 +595,7 @@ impl mir::Module {
}
}
Ok(ModuleCodegen {
name: self.name.clone(),
module,
})
Ok(ModuleCodegen { module })
}
}

View File

@ -17,7 +17,7 @@ use crate::{
},
};
use super::{allocator::Allocator, ErrorKind, IntrinsicFunction, ModuleCodegen};
use super::{allocator::Allocator, ErrorKind, IntrinsicFunction};
pub struct Scope<'ctx, 'scope> {
pub(super) context: &'ctx Context,

View File

@ -14,10 +14,7 @@ use crate::{
mir::{self, CustomTypeKey, Metadata, SourceModuleId, TypeDefinition, TypeDefinitionKind, TypeKind, VagueLiteral},
};
use super::{
scope::{Debug, Scope},
ModuleCodegen,
};
use super::scope::{Debug, Scope};
impl mir::CmpOperator {
pub(super) fn predicate(&self) -> CmpPredicate {

View File

@ -1,5 +1,3 @@
use reid_lib::builder::TypeValue;
use crate::util::maybe;
use super::{typecheck::typerefs::TypeRefs, *};

View File

@ -1,9 +1,8 @@
use std::{
cell::{RefCell, RefMut},
cell::RefCell,
collections::{HashMap, HashSet},
convert::Infallible,
fs::{self},
hash::Hash,
path::PathBuf,
rc::Rc,
};
@ -12,8 +11,8 @@ use crate::{
compile_module,
error_raporting::{ErrorModules, ReidError},
mir::{
pass::BinopKey, BinopDefinition, CustomTypeKey, FunctionDefinitionKind, FunctionParam, SourceModuleId,
StructType, TypeDefinition, TypeDefinitionKind, TypeKind,
pass::BinopKey, BinopDefinition, CustomTypeKey, FunctionDefinitionKind, SourceModuleId, StructType,
TypeDefinition, TypeDefinitionKind, TypeKind,
},
parse_module,
};

View File

@ -177,12 +177,7 @@ impl mir::Expression {
globals.extend(expression.gen_macros(data, state, map));
globals.extend(expression1.gen_macros(data, state, map));
}
mir::ExprKind::AssociatedFunctionCall(
_,
FunctionCall {
parameters, is_macro, ..
},
) => {
mir::ExprKind::AssociatedFunctionCall(_, FunctionCall { parameters, .. }) => {
for expression in parameters {
globals.extend(expression.gen_macros(data, state, map));
}

View File

@ -84,7 +84,7 @@ impl<'t> Pass for TypeCheck<'t> {
fn check_typedefs_for_recursion<'a, 'b>(
defmap: &'b HashMap<&'a String, &'b TypeDefinition>,
typedef: &'b TypeDefinition,
mut seen: HashSet<String>,
seen: HashSet<String>,
state: &mut TypecheckPassState,
) {
match &typedef.kind {
@ -194,7 +194,7 @@ impl FunctionDefinitionKind {
block.typecheck(&mut state.inner(), &typerefs, hint.into())
}
FunctionDefinitionKind::Extern(_) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))),
FunctionDefinitionKind::Intrinsic(intrinsic) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))),
FunctionDefinitionKind::Intrinsic(_) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))),
}
}
}
@ -771,7 +771,7 @@ impl Expression {
Ok(function_call.return_type.clone().resolve_ref(typerefs))
}
}
ExprKind::GlobalRef(global_value, type_kind) => Ok(self
ExprKind::GlobalRef(..) => Ok(self
.return_type(typerefs, state.scope.module_id.unwrap())
.map(|r| r.1)
.unwrap()),

View File

@ -14,8 +14,8 @@ use crate::{
mir::{
implement::TypeCategory,
pass::{AssociatedFunctionKey, ScopeVariable},
BinopDefinition, Block, CustomTypeKey, ExprKind, Expression, FunctionDefinition, FunctionDefinitionKind,
IfExpression, Module, ReturnKind, StmtKind, TypeKind, VagueType, WhileStatement,
BinopDefinition, Block, ExprKind, Expression, FunctionDefinition, FunctionDefinitionKind, IfExpression, Module,
ReturnKind, StmtKind, TypeKind, VagueType, WhileStatement,
},
util::try_all,
};
@ -685,7 +685,7 @@ impl Expression {
// Provide function return type
Ok(type_refs.from_type(&fn_call.ret).unwrap())
}
ExprKind::GlobalRef(global_value, type_kind) => Ok(self
ExprKind::GlobalRef(..) => Ok(self
.return_type(type_refs.types, state.scope.module_id.unwrap())
.map(|r| type_refs.from_type(&r.1).unwrap())
.unwrap()),