From 1e775a3dd813c8bcf0e07a08524f0185769f7c30 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 24 Jan 2024 23:32:10 -0500 Subject: [PATCH] Clean up more unused Nat stuff --- crates/compiler/mono/src/ir.rs | 1 - crates/compiler/solve/src/ability.rs | 27 +++++++++++---------------- crates/compiler/types/src/subs.rs | 19 ------------------- crates/reporting/src/error/type.rs | 3 +-- 4 files changed, 12 insertions(+), 38 deletions(-) diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs index 7a79555c25e..19571a5a23c 100644 --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -6845,7 +6845,6 @@ fn register_capturing_closure<'a>( args, closure_var, ret, - env.target_info, ) }; diff --git a/crates/compiler/solve/src/ability.rs b/crates/compiler/solve/src/ability.rs index 52639de5ef5..05ee2dd45a8 100644 --- a/crates/compiler/solve/src/ability.rs +++ b/crates/compiler/solve/src/ability.rs @@ -10,8 +10,7 @@ use roc_error_macros::internal_error; use roc_module::symbol::{ModuleId, Symbol}; use roc_region::all::{Loc, Region}; use roc_solve_problem::{ - NotDerivableContext, NotDerivableDecode, NotDerivableEncode, NotDerivableEq, TypeError, - UnderivableReason, Unfulfilled, + NotDerivableContext, NotDerivableEq, TypeError, UnderivableReason, Unfulfilled, }; use roc_solve_schema::UnificationMode; use roc_types::num::NumericRange; @@ -508,7 +507,6 @@ fn is_builtin_dec_alias(symbol: Symbol) -> bool { #[inline(always)] fn is_builtin_number_alias(symbol: Symbol) -> bool { is_builtin_fixed_int_alias(symbol) - || is_builtin_nat_alias(symbol) || is_builtin_float_alias(symbol) || is_builtin_dec_alias(symbol) } @@ -947,8 +945,7 @@ impl DerivableVisitor for DeriveEncoding { #[inline(always)] fn is_derivable_builtin_opaque(symbol: Symbol) -> bool { - (is_builtin_number_alias(symbol) && !is_builtin_nat_alias(symbol)) - || is_builtin_bool_alias(symbol) + is_builtin_number_alias(symbol) || is_builtin_bool_alias(symbol) } #[inline(always)] @@ -1015,7 +1012,7 @@ impl DerivableVisitor for DeriveEncoding { } #[inline(always)] - fn visit_alias(var: Variable, symbol: Symbol) -> Result { + fn visit_alias(_var: Variable, symbol: Symbol) -> Result { Ok(Descend(!is_builtin_number_alias(symbol))) } @@ -1041,8 +1038,7 @@ impl DerivableVisitor for DeriveDecoding { #[inline(always)] fn is_derivable_builtin_opaque(symbol: Symbol) -> bool { - (is_builtin_number_alias(symbol) && !is_builtin_nat_alias(symbol)) - || is_builtin_bool_alias(symbol) + is_builtin_number_alias(symbol) || is_builtin_bool_alias(symbol) } #[inline(always)] @@ -1075,9 +1071,9 @@ impl DerivableVisitor for DeriveDecoding { if subs[field].is_optional() { return Err(NotDerivable { var, - context: NotDerivableContext::Decode(NotDerivableDecode::OptionalRecordField( + context: NotDerivableContext::DecodeOptionalRecordField( subs[field_name].clone(), - )), + ), }); } } @@ -1120,7 +1116,7 @@ impl DerivableVisitor for DeriveDecoding { } #[inline(always)] - fn visit_alias(var: Variable, symbol: Symbol) -> Result { + fn visit_alias(_var: Variable, symbol: Symbol) -> Result { Ok(Descend(!is_builtin_number_alias(symbol))) } @@ -1179,9 +1175,9 @@ impl DerivableVisitor for DeriveHash { if subs[field].is_optional() { return Err(NotDerivable { var, - context: NotDerivableContext::Decode(NotDerivableDecode::OptionalRecordField( + context: NotDerivableContext::DecodeOptionalRecordField( subs[field_name].clone(), - )), + ), }); } } @@ -1255,7 +1251,6 @@ impl DerivableVisitor for DeriveEq { #[inline(always)] fn is_derivable_builtin_opaque(symbol: Symbol) -> bool { is_builtin_fixed_int_alias(symbol) - || is_builtin_nat_alias(symbol) || is_builtin_dec_alias(symbol) || is_builtin_bool_alias(symbol) } @@ -1294,9 +1289,9 @@ impl DerivableVisitor for DeriveEq { if subs[field].is_optional() { return Err(NotDerivable { var, - context: NotDerivableContext::Decode(NotDerivableDecode::OptionalRecordField( + context: NotDerivableContext::DecodeOptionalRecordField( subs[field_name].clone(), - )), + ), }); } } diff --git a/crates/compiler/types/src/subs.rs b/crates/compiler/types/src/subs.rs index 12077c606a3..b5b2de55ad9 100644 --- a/crates/compiler/types/src/subs.rs +++ b/crates/compiler/types/src/subs.rs @@ -1277,8 +1277,6 @@ define_const_var! { :pub UNSIGNED64, :pub UNSIGNED128, - :pub NATURAL, - // Integer Signed8 := Signed8 INTEGER_SIGNED8, INTEGER_SIGNED16, @@ -1292,8 +1290,6 @@ define_const_var! { INTEGER_UNSIGNED64, INTEGER_UNSIGNED128, - INTEGER_NATURAL, - // Num (Integer Signed8) := Integer Signed8 NUM_INTEGER_SIGNED8, NUM_INTEGER_SIGNED16, @@ -1307,8 +1303,6 @@ define_const_var! { NUM_INTEGER_UNSIGNED64, NUM_INTEGER_UNSIGNED128, - NUM_INTEGER_NATURAL, - // I8 : Num (Integer Signed8) :pub I8, :pub I16, @@ -1322,8 +1316,6 @@ define_const_var! { :pub U64, :pub U128, - :pub NAT, - // Binary32 : [] BINARY32, BINARY64, @@ -1382,8 +1374,6 @@ impl Variable { Symbol::NUM_U16 => Some(Variable::U16), Symbol::NUM_U8 => Some(Variable::U8), - Symbol::NUM_NAT => Some(Variable::NAT), - Symbol::BOOL_BOOL => Some(Variable::BOOL), Symbol::NUM_F64 => Some(Variable::F64), @@ -1589,15 +1579,6 @@ fn define_integer_types(subs: &mut Subs) { Variable::NUM_INTEGER_UNSIGNED8, Variable::U8, ); - - integer_type( - subs, - Symbol::NUM_NAT, - Variable::NATURAL, - Variable::INTEGER_NATURAL, - Variable::NUM_INTEGER_NATURAL, - Variable::NAT, - ); } #[allow(clippy::too_many_arguments)] diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs index a074fe9cda3..e5a39fc134e 100644 --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -15,8 +15,7 @@ use roc_module::symbol::Symbol; use roc_problem::Severity; use roc_region::all::{LineInfo, Region}; use roc_solve_problem::{ - NotDerivableContext, NotDerivableDecode, NotDerivableEncode, NotDerivableEq, TypeError, - UnderivableReason, Unfulfilled, + NotDerivableContext, NotDerivableEq, TypeError, UnderivableReason, Unfulfilled, }; use roc_std::RocDec; use roc_types::pretty_print::{Parens, WILDCARD};