From 6f94ae2b2a76e9b8670d07a28b7558a08b380ac4 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Wed, 1 Jan 2025 19:20:56 +0100 Subject: [PATCH] reducing amound ot needless diagnostics caused transitively Signed-off-by: Jakub Doka --- lang/src/son.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lang/src/son.rs b/lang/src/son.rs index f50ca39..4761371 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -1304,6 +1304,7 @@ impl<'a> Codegen<'a> { self.ci.nodes.unlock_remove(end); let elem = match bs.ty.expand() { + ty::Kind::NEVER => ty::Id::NEVER, ty::Kind::Slice(s) => self.tys.ins.slices[s].elem, ty::Kind::Ptr(_) => self.tys.base_of(bs.ty).unwrap_or(bs.ty), _ => { @@ -1318,6 +1319,7 @@ impl<'a> Codegen<'a> { }; let mut ptr = match bs.ty.expand() { + ty::Kind::NEVER => bs, ty::Kind::Slice(s) if let Some(_) = self.tys.ins.slices[s].len() => bs, ty::Kind::Slice(_) => { let off = self.offset(bs.id, SLICE_PTR_OFF); @@ -1363,6 +1365,7 @@ impl<'a> Codegen<'a> { let idx = self.checked_expr(index, ty::Id::DINT, "subscript")?; match bs.ty.expand() { + ty::Kind::NEVER => Value::NEVER, ty::Kind::Slice(s) if self.tys.ins.slices[s].len().is_some() => { let elem = self.tys.ins.slices[s].elem; Some(self.offset_ptr(bs.id, elem, idx.id)) @@ -2592,6 +2595,7 @@ impl<'a> Codegen<'a> { let tty = vtarget.ty; match self.tys.base_of(tty).unwrap_or(tty).expand() { + ty::Kind::NEVER => Value::NEVER, ty::Kind::Module(m) => self.find_type_as_value(pos, m, name, ctx), ty::Kind::Enum(e) => { let intrnd = self.tys.names.project(name); @@ -2654,6 +2658,7 @@ impl<'a> Codegen<'a> { Some(Value::ptr(self.offset(vtarget.id, offset)).ty(ty)) } ty::Kind::TYPE => match self.ci.nodes.as_ty(vtarget.id).expand() { + ty::Kind::NEVER => Value::NEVER, ty::Kind::Module(m) => self.find_type_as_value(pos, m, name, ctx), ty::Kind::Enum(e) if let intrnd = self.tys.names.project(name)