reducing amound ot needless diagnostics caused transitively

Signed-off-by: Jakub Doka <jakub.doka2@gmail.com>
This commit is contained in:
Jakub Doka 2025-01-01 19:20:56 +01:00
parent 2c53f9ece9
commit 6f94ae2b2a
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -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)