From 61250c906a81b3ae35477f8e44021889d361e225 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sun, 3 Nov 2024 21:31:46 +0100 Subject: [PATCH] comparison of non null types to null are now errors --- lang/src/son.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lang/src/son.rs b/lang/src/son.rs index 087d485c..351ff940 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -2704,7 +2704,11 @@ impl<'a> Codegen<'a> { self.strip_var(&mut cmped); let Some(ty) = self.tys.inner_of(cmped.ty) else { - return Some(self.ci.nodes.new_const_lit(ty::Id::BOOL, 1)); + self.report( + left.pos(), + fa!("'{}' is never null, remove this check", self.ty_display(cmped.ty)), + ); + return Value::NEVER; }; Some(Value::new(self.gen_null_check(cmped, ty, op)).ty(ty::BOOL))