changing case checking to a warning
This commit is contained in:
parent
95e9270fef
commit
542c69fd60
|
@ -1034,6 +1034,7 @@ pub struct Types {
|
|||
tasks: Vec<Option<FTask>>,
|
||||
}
|
||||
|
||||
// TODO: remove this
|
||||
trait TypeParser {
|
||||
fn tys(&mut self) -> &mut Types;
|
||||
fn ty_display(&self, of: ty::Id) -> ty::Display;
|
||||
|
@ -1043,6 +1044,7 @@ trait TypeParser {
|
|||
fn eval_global(&mut self, file: Module, name: Ident, expr: &Expr) -> ty::Id;
|
||||
fn infer_type(&mut self, expr: &Expr) -> ty::Id;
|
||||
fn error(&self, file: Module, pos: Pos, msg: impl Display) -> ty::Id;
|
||||
fn warn(&self, file: Module, pos: Pos, msg: impl Display) -> ty::Id;
|
||||
|
||||
fn find_type(
|
||||
&mut self,
|
||||
|
@ -1118,7 +1120,7 @@ trait TypeParser {
|
|||
};
|
||||
|
||||
if let Err(proper_case) = self.tys().case(ty)(f.ident_str(name)) {
|
||||
self.error(
|
||||
self.warn(
|
||||
from_file,
|
||||
pos,
|
||||
format_args!(
|
||||
|
|
|
@ -4969,7 +4969,7 @@ impl<'a> Codegen<'a> {
|
|||
|
||||
#[track_caller]
|
||||
fn warn(&self, pos: Pos, msg: impl core::fmt::Display) {
|
||||
let mut buf = self.errors.borrow_mut();
|
||||
let mut buf = self.warnings.borrow_mut();
|
||||
write!(buf, "(W) {}", self.file().report(pos, msg)).unwrap();
|
||||
}
|
||||
|
||||
|
@ -5072,6 +5072,12 @@ impl TypeParser for Codegen<'_> {
|
|||
ty::Id::NEVER
|
||||
}
|
||||
|
||||
fn warn(&self, file: Module, pos: Pos, msg: impl Display) -> ty::Id {
|
||||
let mut buf = self.warnings.borrow_mut();
|
||||
write!(buf, "(W) {}", self.files[file.index()].report(pos, msg)).unwrap();
|
||||
ty::Id::NEVER
|
||||
}
|
||||
|
||||
fn find_local_ty(&mut self, ident: Ident) -> Option<ty::Id> {
|
||||
self.ci.scope.vars.iter().rfind(|v| (v.id == ident && v.value() == NEVER)).map(|v| v.ty)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue