Skip to content

Commit

Permalink
Clean up more unused Nat stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rtfeldman committed Jan 25, 2024
1 parent 86f1ce6 commit 1e775a3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 38 deletions.
1 change: 0 additions & 1 deletion crates/compiler/mono/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6845,7 +6845,6 @@ fn register_capturing_closure<'a>(
args,
closure_var,
ret,
env.target_info,
)
};

Expand Down
27 changes: 11 additions & 16 deletions crates/compiler/solve/src/ability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -1015,7 +1012,7 @@ impl DerivableVisitor for DeriveEncoding {
}

#[inline(always)]
fn visit_alias(var: Variable, symbol: Symbol) -> Result<Descend, NotDerivable> {
fn visit_alias(_var: Variable, symbol: Symbol) -> Result<Descend, NotDerivable> {
Ok(Descend(!is_builtin_number_alias(symbol)))
}

Expand All @@ -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)]
Expand Down Expand Up @@ -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(),
)),
),
});
}
}
Expand Down Expand Up @@ -1120,7 +1116,7 @@ impl DerivableVisitor for DeriveDecoding {
}

#[inline(always)]
fn visit_alias(var: Variable, symbol: Symbol) -> Result<Descend, NotDerivable> {
fn visit_alias(_var: Variable, symbol: Symbol) -> Result<Descend, NotDerivable> {
Ok(Descend(!is_builtin_number_alias(symbol)))
}

Expand Down Expand Up @@ -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(),
)),
),
});
}
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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(),
)),
),
});
}
}
Expand Down
19 changes: 0 additions & 19 deletions crates/compiler/types/src/subs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1277,8 +1277,6 @@ define_const_var! {
:pub UNSIGNED64,
:pub UNSIGNED128,

:pub NATURAL,

// Integer Signed8 := Signed8
INTEGER_SIGNED8,
INTEGER_SIGNED16,
Expand All @@ -1292,8 +1290,6 @@ define_const_var! {
INTEGER_UNSIGNED64,
INTEGER_UNSIGNED128,

INTEGER_NATURAL,

// Num (Integer Signed8) := Integer Signed8
NUM_INTEGER_SIGNED8,
NUM_INTEGER_SIGNED16,
Expand All @@ -1307,8 +1303,6 @@ define_const_var! {
NUM_INTEGER_UNSIGNED64,
NUM_INTEGER_UNSIGNED128,

NUM_INTEGER_NATURAL,

// I8 : Num (Integer Signed8)
:pub I8,
:pub I16,
Expand All @@ -1322,8 +1316,6 @@ define_const_var! {
:pub U64,
:pub U128,

:pub NAT,

// Binary32 : []
BINARY32,
BINARY64,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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)]
Expand Down
3 changes: 1 addition & 2 deletions crates/reporting/src/error/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 1e775a3

Please sign in to comment.