forked from AbleOS/holey-bytes
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>>,
|
tasks: Vec<Option<FTask>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove this
|
||||||
trait TypeParser {
|
trait TypeParser {
|
||||||
fn tys(&mut self) -> &mut Types;
|
fn tys(&mut self) -> &mut Types;
|
||||||
fn ty_display(&self, of: ty::Id) -> ty::Display;
|
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 eval_global(&mut self, file: Module, name: Ident, expr: &Expr) -> ty::Id;
|
||||||
fn infer_type(&mut self, 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 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(
|
fn find_type(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -1118,7 +1120,7 @@ trait TypeParser {
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(proper_case) = self.tys().case(ty)(f.ident_str(name)) {
|
if let Err(proper_case) = self.tys().case(ty)(f.ident_str(name)) {
|
||||||
self.error(
|
self.warn(
|
||||||
from_file,
|
from_file,
|
||||||
pos,
|
pos,
|
||||||
format_args!(
|
format_args!(
|
||||||
|
|
|
@ -4969,7 +4969,7 @@ impl<'a> Codegen<'a> {
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn warn(&self, pos: Pos, msg: impl core::fmt::Display) {
|
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();
|
write!(buf, "(W) {}", self.file().report(pos, msg)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5072,6 +5072,12 @@ impl TypeParser for Codegen<'_> {
|
||||||
ty::Id::NEVER
|
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> {
|
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)
|
self.ci.scope.vars.iter().rfind(|v| (v.id == ident && v.value() == NEVER)).map(|v| v.ty)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue