mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
auto clippy fixes
This commit is contained in:
parent
72c85efc83
commit
ef39bad7c6
146 changed files with 750 additions and 1005 deletions
|
@ -138,7 +138,7 @@ fn eq_struct<'a>(
|
|||
) -> Stmt<'a> {
|
||||
let mut else_stmt = Stmt::Ret(Symbol::BOOL_TRUE);
|
||||
for (i, layout) in field_layouts.iter().enumerate().rev() {
|
||||
let field1_sym = root.create_symbol(ident_ids, &format!("field_1_{}", i));
|
||||
let field1_sym = root.create_symbol(ident_ids, &format!("field_1_{i}"));
|
||||
let field1_expr = Expr::StructAtIndex {
|
||||
index: i as u64,
|
||||
field_layouts,
|
||||
|
@ -146,7 +146,7 @@ fn eq_struct<'a>(
|
|||
};
|
||||
let field1_stmt = |next| Stmt::Let(field1_sym, field1_expr, *layout, next);
|
||||
|
||||
let field2_sym = root.create_symbol(ident_ids, &format!("field_2_{}", i));
|
||||
let field2_sym = root.create_symbol(ident_ids, &format!("field_2_{i}"));
|
||||
let field2_expr = Expr::StructAtIndex {
|
||||
index: i as u64,
|
||||
field_layouts,
|
||||
|
@ -164,7 +164,7 @@ fn eq_struct<'a>(
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
let eq_call_name = format!("eq_call_{}", i);
|
||||
let eq_call_name = format!("eq_call_{i}");
|
||||
let eq_call_sym = root.create_symbol(ident_ids, &eq_call_name);
|
||||
let eq_call_stmt = |next| Stmt::Let(eq_call_sym, eq_call_expr, LAYOUT_BOOL, next);
|
||||
|
||||
|
@ -488,8 +488,8 @@ fn eq_tag_fields<'a>(
|
|||
Some(i) => {
|
||||
// Implement tail recursion on this RecursivePointer,
|
||||
// in the innermost `else` clause after all other fields have been checked
|
||||
let field1_sym = root.create_symbol(ident_ids, &format!("field_1_{}_{}", tag_id, i));
|
||||
let field2_sym = root.create_symbol(ident_ids, &format!("field_2_{}_{}", tag_id, i));
|
||||
let field1_sym = root.create_symbol(ident_ids, &format!("field_1_{tag_id}_{i}"));
|
||||
let field2_sym = root.create_symbol(ident_ids, &format!("field_2_{tag_id}_{i}"));
|
||||
|
||||
let field1_expr = Expr::UnionAtIndex {
|
||||
union_layout,
|
||||
|
@ -533,8 +533,8 @@ fn eq_tag_fields<'a>(
|
|||
continue; // the tail-recursive field is handled elsewhere
|
||||
}
|
||||
|
||||
let field1_sym = root.create_symbol(ident_ids, &format!("field_1_{}_{}", tag_id, i));
|
||||
let field2_sym = root.create_symbol(ident_ids, &format!("field_2_{}_{}", tag_id, i));
|
||||
let field1_sym = root.create_symbol(ident_ids, &format!("field_1_{tag_id}_{i}"));
|
||||
let field2_sym = root.create_symbol(ident_ids, &format!("field_2_{tag_id}_{i}"));
|
||||
|
||||
let field1_expr = Expr::UnionAtIndex {
|
||||
union_layout,
|
||||
|
@ -560,7 +560,7 @@ fn eq_tag_fields<'a>(
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
let eq_call_name = format!("eq_call_{}", i);
|
||||
let eq_call_name = format!("eq_call_{i}");
|
||||
let eq_call_sym = root.create_symbol(ident_ids, &eq_call_name);
|
||||
|
||||
stmt = Stmt::Let(
|
||||
|
|
|
@ -783,7 +783,7 @@ impl<'a> CallerProc<'a> {
|
|||
.pretty(80)
|
||||
.to_string();
|
||||
|
||||
println!("{}", doc);
|
||||
println!("{doc}");
|
||||
}
|
||||
|
||||
Self {
|
||||
|
|
|
@ -1276,7 +1276,7 @@ fn refcount_struct<'a>(
|
|||
|
||||
for (i, field_layout) in field_layouts.iter().enumerate().rev() {
|
||||
if layout_interner.contains_refcounted(*field_layout) {
|
||||
let field_val = root.create_symbol(ident_ids, &format!("field_val_{}", i));
|
||||
let field_val = root.create_symbol(ident_ids, &format!("field_val_{i}"));
|
||||
let field_val_expr = Expr::StructAtIndex {
|
||||
index: i as u64,
|
||||
field_layouts,
|
||||
|
@ -1284,7 +1284,7 @@ fn refcount_struct<'a>(
|
|||
};
|
||||
let field_val_stmt = |next| Stmt::Let(field_val, field_val_expr, *field_layout, next);
|
||||
|
||||
let mod_unit = root.create_symbol(ident_ids, &format!("mod_field_{}", i));
|
||||
let mod_unit = root.create_symbol(ident_ids, &format!("mod_field_{i}"));
|
||||
let mod_args = refcount_args(root, ctx, field_val);
|
||||
let mod_expr = root
|
||||
.call_specialized_op(ident_ids, ctx, layout_interner, *field_layout, mod_args)
|
||||
|
@ -1758,7 +1758,7 @@ fn refcount_union_tailrec<'a>(
|
|||
filtered.push((i, *field));
|
||||
} else {
|
||||
let field_val =
|
||||
root.create_symbol(ident_ids, &format!("field_{}_{}", tag_id, i));
|
||||
root.create_symbol(ident_ids, &format!("field_{tag_id}_{i}"));
|
||||
let field_val_expr = Expr::UnionAtIndex {
|
||||
union_layout,
|
||||
tag_id,
|
||||
|
@ -1896,7 +1896,7 @@ fn refcount_tag_fields<'a>(
|
|||
|
||||
for (i, field_layout) in field_layouts.iter().rev() {
|
||||
if layout_interner.contains_refcounted(*field_layout) {
|
||||
let field_val = root.create_symbol(ident_ids, &format!("field_{}_{}", tag_id, i));
|
||||
let field_val = root.create_symbol(ident_ids, &format!("field_{tag_id}_{i}"));
|
||||
let field_val_expr = Expr::UnionAtIndex {
|
||||
union_layout,
|
||||
tag_id,
|
||||
|
@ -1905,7 +1905,7 @@ fn refcount_tag_fields<'a>(
|
|||
};
|
||||
let field_val_stmt = |next| Stmt::Let(field_val, field_val_expr, *field_layout, next);
|
||||
|
||||
let mod_unit = root.create_symbol(ident_ids, &format!("mod_field_{}_{}", tag_id, i));
|
||||
let mod_unit = root.create_symbol(ident_ids, &format!("mod_field_{tag_id}_{i}"));
|
||||
let mod_args = refcount_args(root, ctx, field_val);
|
||||
let mod_expr = root
|
||||
.call_specialized_op(ident_ids, ctx, layout_interner, *field_layout, mod_args)
|
||||
|
|
|
@ -62,7 +62,7 @@ where
|
|||
.pretty(80)
|
||||
.to_string();
|
||||
|
||||
eprintln!("Full source: {}", src);
|
||||
eprintln!("Full source: {src}");
|
||||
|
||||
let interpolated_docs = stack(
|
||||
f,
|
||||
|
|
|
@ -806,7 +806,7 @@ fn specialize_struct<'a, 'i>(
|
|||
// This value has not been index before, create a new symbol.
|
||||
None => {
|
||||
let field_symbol =
|
||||
environment.create_symbol(ident_ids, &format!("field_val_{}", i));
|
||||
environment.create_symbol(ident_ids, &format!("field_val_{i}"));
|
||||
|
||||
let field_val_expr = Expr::StructAtIndex {
|
||||
index: i as u64,
|
||||
|
@ -945,7 +945,7 @@ fn specialize_union<'a, 'i>(
|
|||
Some(rc) => {
|
||||
let field_symbol = environment.create_symbol(
|
||||
ident_ids,
|
||||
&format!("field_val_{}", i),
|
||||
&format!("field_val_{i}"),
|
||||
);
|
||||
|
||||
let field_val_expr = Expr::UnionAtIndex {
|
||||
|
@ -1134,11 +1134,11 @@ fn specialize_list<'a, 'i>(
|
|||
// If the symbol is unknown, we have to get the value from the list.
|
||||
// Should only happen when list elements are discarded.
|
||||
None => {
|
||||
let field_symbol = environment
|
||||
.create_symbol(ident_ids, &format!("field_val_{}", i));
|
||||
let field_symbol =
|
||||
environment.create_symbol(ident_ids, &format!("field_val_{i}"));
|
||||
|
||||
let index_symbol = environment
|
||||
.create_symbol(ident_ids, &format!("index_val_{}", i));
|
||||
let index_symbol =
|
||||
environment.create_symbol(ident_ids, &format!("index_val_{i}"));
|
||||
|
||||
let dec = arena.alloc(Stmt::Refcounting(
|
||||
ModifyRc::Dec(field_symbol),
|
||||
|
|
|
@ -181,8 +181,7 @@ impl<'a> PartialProcs<'a> {
|
|||
pub fn insert(&mut self, symbol: Symbol, partial_proc: PartialProc<'a>) -> PartialProcId {
|
||||
debug_assert!(
|
||||
!self.contains_key(symbol),
|
||||
"The {:?} is inserted as a partial proc twice: that's a bug!",
|
||||
symbol,
|
||||
"The {symbol:?} is inserted as a partial proc twice: that's a bug!",
|
||||
);
|
||||
|
||||
let id = PartialProcId(self.symbols.len());
|
||||
|
@ -675,7 +674,7 @@ impl<'a> Specialized<'a> {
|
|||
} else {
|
||||
match in_progress {
|
||||
InProgressProc::InProgress => {
|
||||
panic!("Function {:?} ({:?}) is not done specializing", s, l)
|
||||
panic!("Function {s:?} ({l:?}) is not done specializing")
|
||||
}
|
||||
InProgressProc::Done(proc) => Some((s, l, proc)),
|
||||
}
|
||||
|
@ -838,11 +837,7 @@ impl<'a> SymbolSpecializations<'a> {
|
|||
/// Only those bound to number literals can be compiled polymorphically.
|
||||
fn mark_eligible(&mut self, symbol: Symbol) {
|
||||
let _old = self.0.insert(symbol, VecMap::with_capacity(1));
|
||||
debug_assert!(
|
||||
_old.is_none(),
|
||||
"overwriting specializations for {:?}",
|
||||
symbol
|
||||
);
|
||||
debug_assert!(_old.is_none(), "overwriting specializations for {symbol:?}");
|
||||
}
|
||||
|
||||
/// Removes all specializations for a symbol, returning the type and symbol of each specialization.
|
||||
|
@ -945,8 +940,7 @@ impl<'a> Procs<'a> {
|
|||
.expect("specialization stack is empty");
|
||||
debug_assert_eq!(
|
||||
popped, specialization,
|
||||
"incorrect popped specialization: passed {:?}, but was {:?}",
|
||||
specialization, popped
|
||||
"incorrect popped specialization: passed {specialization:?}, but was {popped:?}"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1020,7 @@ impl<'a> Procs<'a> {
|
|||
) -> Result<ProcLayout<'a>, RuntimeError> {
|
||||
let raw_layout = layout_cache
|
||||
.raw_from_var(env.arena, annotation, env.subs)
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {:?}", err));
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {err:?}"));
|
||||
|
||||
let top_level = ProcLayout::from_raw_named(env.arena, name, raw_layout);
|
||||
|
||||
|
@ -1054,7 +1048,7 @@ impl<'a> Procs<'a> {
|
|||
// if we've already specialized this one, no further work is needed.
|
||||
if !already_specialized {
|
||||
if self.is_module_thunk(name.name()) {
|
||||
debug_assert!(layout.arguments.is_empty(), "{:?}", name);
|
||||
debug_assert!(layout.arguments.is_empty(), "{name:?}");
|
||||
}
|
||||
|
||||
let needs_suspended_specialization =
|
||||
|
@ -1145,7 +1139,7 @@ impl<'a> Procs<'a> {
|
|||
);
|
||||
}
|
||||
Err(error) => {
|
||||
panic!("TODO generate a RuntimeError message for {:?}", error);
|
||||
panic!("TODO generate a RuntimeError message for {error:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1234,7 +1228,7 @@ impl<'a> Procs<'a> {
|
|||
.insert_specialized(proc_name.name(), proc_layout, proc);
|
||||
}
|
||||
Err(error) => {
|
||||
panic!("TODO generate a RuntimeError message for {:?}", error);
|
||||
panic!("TODO generate a RuntimeError message for {error:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1918,13 +1912,13 @@ pub(crate) fn symbol_to_doc_string(symbol: Symbol, force_pretty: bool) -> String
|
|||
use roc_module::ident::ModuleName;
|
||||
|
||||
if pretty_print_ir_symbols() || force_pretty {
|
||||
format!("{:?}", symbol)
|
||||
format!("{symbol:?}")
|
||||
} else {
|
||||
let text = format!("{}", symbol);
|
||||
let text = format!("{symbol}");
|
||||
|
||||
if text.starts_with(ModuleName::APP) {
|
||||
let name: String = text.trim_start_matches(ModuleName::APP).into();
|
||||
format!("Test{}", name)
|
||||
format!("Test{name}")
|
||||
} else {
|
||||
text
|
||||
}
|
||||
|
@ -2016,7 +2010,7 @@ impl<'a> Expr<'a> {
|
|||
.text("Reset { symbol: ")
|
||||
.append(symbol_to_doc(alloc, *symbol, pretty))
|
||||
.append(", id: ")
|
||||
.append(format!("{:?}", update_mode))
|
||||
.append(format!("{update_mode:?}"))
|
||||
.append(" }"),
|
||||
ResetRef {
|
||||
symbol,
|
||||
|
@ -2025,7 +2019,7 @@ impl<'a> Expr<'a> {
|
|||
.text("ResetRef { symbol: ")
|
||||
.append(symbol_to_doc(alloc, *symbol, pretty))
|
||||
.append(", id: ")
|
||||
.append(format!("{:?}", update_mode))
|
||||
.append(format!("{update_mode:?}"))
|
||||
.append(" }"),
|
||||
Struct(args) => {
|
||||
let it = args.iter().map(|s| symbol_to_doc(alloc, *s, pretty));
|
||||
|
@ -3036,7 +3030,7 @@ fn specialize_external_help<'a>(
|
|||
let partial_proc_id = match procs.partial_procs.symbol_to_id(name.name()) {
|
||||
Some(v) => v,
|
||||
None => {
|
||||
panic!("Cannot find a partial proc for {:?}", name);
|
||||
panic!("Cannot find a partial proc for {name:?}");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3765,8 +3759,7 @@ fn build_specialized_proc<'a>(
|
|||
debug_assert_eq!(
|
||||
pattern_layouts_len + 1,
|
||||
pattern_symbols.len(),
|
||||
"Tried to zip two vecs with different lengths in {:?}!",
|
||||
proc_name,
|
||||
"Tried to zip two vecs with different lengths in {proc_name:?}!",
|
||||
);
|
||||
|
||||
let proc_args = proc_args.into_bump_slice();
|
||||
|
@ -3806,14 +3799,12 @@ fn build_specialized_proc<'a>(
|
|||
// so far, the problem when hitting this branch was always somewhere else
|
||||
// I think this branch should not be reachable in a bugfree compiler
|
||||
panic!(
|
||||
"more arguments (according to the layout) than argument symbols for {:?}",
|
||||
proc_name
|
||||
"more arguments (according to the layout) than argument symbols for {proc_name:?}"
|
||||
)
|
||||
}
|
||||
}
|
||||
Ordering::Less => panic!(
|
||||
"more argument symbols than arguments (according to the layout) for {:?}",
|
||||
proc_name
|
||||
"more argument symbols than arguments (according to the layout) for {proc_name:?}"
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -3845,14 +3836,12 @@ fn build_specialized_proc<'a>(
|
|||
// so far, the problem when hitting this branch was always somewhere else
|
||||
// I think this branch should not be reachable in a bugfree compiler
|
||||
panic!(
|
||||
"more arguments (according to the layout) than argument symbols for {:?}",
|
||||
proc_name
|
||||
"more arguments (according to the layout) than argument symbols for {proc_name:?}"
|
||||
)
|
||||
}
|
||||
}
|
||||
Ordering::Less => panic!(
|
||||
"more argument symbols than arguments (according to the layout) for {:?}",
|
||||
proc_name
|
||||
"more argument symbols than arguments (according to the layout) for {proc_name:?}"
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -3881,7 +3870,7 @@ fn specialize_variable<'a>(
|
|||
// TODO: can we get rid of raw entirely?
|
||||
let raw = layout_cache
|
||||
.raw_from_var(env.arena, fn_var, env.subs)
|
||||
.unwrap_or_else(|err| panic!("TODO handle invalid function {:?}", err));
|
||||
.unwrap_or_else(|err| panic!("TODO handle invalid function {err:?}"));
|
||||
|
||||
let raw = if procs.is_module_thunk(proc_name.name()) {
|
||||
match raw {
|
||||
|
@ -4043,7 +4032,7 @@ fn specialize_naked_symbol<'a>(
|
|||
return result;
|
||||
} else if env.is_imported_symbol(symbol) {
|
||||
match layout_cache.from_var(env.arena, variable, env.subs) {
|
||||
Err(e) => panic!("invalid layout {:?}", e),
|
||||
Err(e) => panic!("invalid layout {e:?}"),
|
||||
Ok(_) => {
|
||||
// this is a 0-arity thunk
|
||||
let result = call_by_name(
|
||||
|
@ -4573,7 +4562,7 @@ pub fn with_hole<'a>(
|
|||
let layout = layout_cache
|
||||
.from_var(env.arena, branch_var, env.subs)
|
||||
.unwrap_or_else(|err| {
|
||||
panic!("TODO turn fn_var into a RuntimeError {:?}", err)
|
||||
panic!("TODO turn fn_var into a RuntimeError {err:?}")
|
||||
});
|
||||
|
||||
let param = Param {
|
||||
|
@ -4639,7 +4628,7 @@ pub fn with_hole<'a>(
|
|||
|
||||
let layout = layout_cache
|
||||
.from_var(env.arena, expr_var, env.subs)
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {:?}", err));
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {err:?}"));
|
||||
|
||||
let param = Param {
|
||||
symbol: assigned,
|
||||
|
@ -4692,7 +4681,7 @@ pub fn with_hole<'a>(
|
|||
|
||||
let elem_layout = layout_cache
|
||||
.from_var(env.arena, elem_var, env.subs)
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {:?}", err));
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {err:?}"));
|
||||
|
||||
for arg_expr in loc_elems.into_iter() {
|
||||
if let Some(literal) =
|
||||
|
@ -5033,7 +5022,7 @@ pub fn with_hole<'a>(
|
|||
|
||||
let record_layout = layout_cache
|
||||
.from_var(env.arena, record_var, env.subs)
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {:?}", err));
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {err:?}"));
|
||||
|
||||
let field_layouts = match layout_cache.get_repr(record_layout) {
|
||||
LayoutRepr::Struct(field_layouts) => field_layouts,
|
||||
|
@ -5181,7 +5170,7 @@ pub fn with_hole<'a>(
|
|||
if let Err(e) = inserted {
|
||||
return runtime_error(
|
||||
env,
|
||||
env.arena.alloc(format!("RuntimeError: {:?}", e,)),
|
||||
env.arena.alloc(format!("RuntimeError: {e:?}",)),
|
||||
);
|
||||
} else {
|
||||
drop(inserted);
|
||||
|
@ -5754,7 +5743,7 @@ fn compile_struct_like_access<'a>(
|
|||
|
||||
let layout = layout_cache
|
||||
.from_var(env.arena, elem_var, env.subs)
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {:?}", err));
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {err:?}"));
|
||||
|
||||
Stmt::Let(assigned, expr, layout, hole)
|
||||
}
|
||||
|
@ -6197,7 +6186,7 @@ fn convert_tag_union<'a>(
|
|||
// Layout will unpack this unwrapped tack if it only has one (non-zero-sized) field
|
||||
let layout = layout_cache
|
||||
.from_var(env.arena, variant_var, env.subs)
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {:?}", err));
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {err:?}"));
|
||||
|
||||
// even though this was originally a Tag, we treat it as a Struct from now on
|
||||
let stmt = if let [only_field] = field_symbols {
|
||||
|
@ -6231,7 +6220,7 @@ fn convert_tag_union<'a>(
|
|||
// Layout will unpack this unwrapped tack if it only has one (non-zero-sized) field
|
||||
let layout = layout_cache
|
||||
.from_var(env.arena, variant_var, env.subs)
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {:?}", err));
|
||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {err:?}"));
|
||||
|
||||
// even though this was originally a Tag, we treat it as a Struct from now on
|
||||
let stmt = if let [only_field] = field_symbols {
|
||||
|
@ -6496,8 +6485,7 @@ fn tag_union_to_function<'a>(
|
|||
Err(e) => runtime_error(
|
||||
env,
|
||||
env.arena.alloc(format!(
|
||||
"Could not produce tag function due to a runtime error: {:?}",
|
||||
e,
|
||||
"Could not produce tag function due to a runtime error: {e:?}",
|
||||
)),
|
||||
),
|
||||
}
|
||||
|
@ -8284,17 +8272,13 @@ fn call_by_name<'a>(
|
|||
match layout_cache.raw_from_var(env.arena, fn_var, env.subs) {
|
||||
Err(LayoutProblem::UnresolvedTypeVar(var)) => {
|
||||
let msg = format!(
|
||||
"Hit an unresolved type variable {:?} when creating a layout for {:?} (var {:?})",
|
||||
var, proc_name, fn_var
|
||||
"Hit an unresolved type variable {var:?} when creating a layout for {proc_name:?} (var {fn_var:?})"
|
||||
);
|
||||
|
||||
evaluate_arguments_then_runtime_error(env, procs, layout_cache, msg, loc_args)
|
||||
}
|
||||
Err(LayoutProblem::Erroneous) => {
|
||||
let msg = format!(
|
||||
"Hit an erroneous type when creating a layout for {:?}",
|
||||
proc_name
|
||||
);
|
||||
let msg = format!("Hit an erroneous type when creating a layout for {proc_name:?}");
|
||||
|
||||
evaluate_arguments_then_runtime_error(env, procs, layout_cache, msg, loc_args)
|
||||
}
|
||||
|
@ -8446,9 +8430,7 @@ fn call_by_name_help<'a>(
|
|||
Some(name) => {
|
||||
debug_assert!(
|
||||
iter_lambda_names.next().is_none(),
|
||||
"Somehow, call by name for {:?} has multiple capture niches: {:?}",
|
||||
proc_name,
|
||||
lambda_set
|
||||
"Somehow, call by name for {proc_name:?} has multiple capture niches: {lambda_set:?}"
|
||||
);
|
||||
name
|
||||
}
|
||||
|
@ -8487,8 +8469,7 @@ fn call_by_name_help<'a>(
|
|||
debug_assert_eq!(
|
||||
argument_layouts.len(),
|
||||
field_symbols.len(),
|
||||
"see call_by_name for background (scroll down a bit), function is {:?}",
|
||||
proc_name,
|
||||
"see call_by_name for background (scroll down a bit), function is {proc_name:?}",
|
||||
);
|
||||
call_specialized_proc(
|
||||
env,
|
||||
|
@ -8539,8 +8520,7 @@ fn call_by_name_help<'a>(
|
|||
debug_assert_eq!(
|
||||
argument_layouts.len(),
|
||||
field_symbols.len(),
|
||||
"see call_by_name for background (scroll down a bit), function is {:?}",
|
||||
proc_name,
|
||||
"see call_by_name for background (scroll down a bit), function is {proc_name:?}",
|
||||
);
|
||||
|
||||
let field_symbols = field_symbols.into_bump_slice();
|
||||
|
@ -8592,8 +8572,7 @@ fn call_by_name_help<'a>(
|
|||
debug_assert_eq!(
|
||||
argument_layouts.len(),
|
||||
field_symbols.len(),
|
||||
"see call_by_name for background (scroll down a bit), function is {:?}",
|
||||
proc_name,
|
||||
"see call_by_name for background (scroll down a bit), function is {proc_name:?}",
|
||||
);
|
||||
|
||||
let field_symbols = field_symbols.into_bump_slice();
|
||||
|
@ -8784,8 +8763,7 @@ fn call_by_name_module_thunk<'a>(
|
|||
Ok((proc, raw_layout)) => {
|
||||
debug_assert!(
|
||||
raw_layout.is_zero_argument_thunk(),
|
||||
"but actually {:?}",
|
||||
raw_layout
|
||||
"but actually {raw_layout:?}"
|
||||
);
|
||||
|
||||
let was_present = procs
|
||||
|
@ -9044,10 +9022,9 @@ where
|
|||
}
|
||||
None => {
|
||||
eprintln!(
|
||||
"a function passed to `{:?}` LowLevel call has an empty lambda set!
|
||||
"a function passed to `{op:?}` LowLevel call has an empty lambda set!
|
||||
The most likely reason is that some symbol you use is not in scope.
|
||||
",
|
||||
op
|
||||
"
|
||||
);
|
||||
|
||||
hole.clone()
|
||||
|
@ -10073,7 +10050,7 @@ fn unique_glue_symbol(
|
|||
use std::fmt::Write;
|
||||
let mut string = bumpalo::collections::String::with_capacity_in(32, arena);
|
||||
|
||||
let _result = write!(&mut string, "roc__getter_{}_{}", module_name, unique_id);
|
||||
let _result = write!(&mut string, "roc__getter_{module_name}_{unique_id}");
|
||||
debug_assert_eq!(_result, Ok(())); // This should never fail, but doesn't hurt to debug-check!
|
||||
|
||||
let bump_string = string.into_bump_str();
|
||||
|
|
|
@ -775,8 +775,7 @@ fn to_relevant_branch<'a>(
|
|||
// if there is no test, the pattern should not require any
|
||||
debug_assert!(
|
||||
matches!(pattern, Pattern::Identifier(_) | Pattern::Underscore,),
|
||||
"{:?}",
|
||||
pattern,
|
||||
"{pattern:?}",
|
||||
);
|
||||
|
||||
Some(branch.clone())
|
||||
|
|
|
@ -165,8 +165,7 @@ impl<'a> LayoutCache<'a> {
|
|||
let Cacheable(value, criteria) = Layout::from_var(&mut env, var);
|
||||
debug_assert!(
|
||||
criteria.is_cacheable(),
|
||||
"{:?} not cacheable as top-level",
|
||||
value
|
||||
"{value:?} not cacheable as top-level"
|
||||
);
|
||||
value
|
||||
}
|
||||
|
@ -192,8 +191,7 @@ impl<'a> LayoutCache<'a> {
|
|||
let Cacheable(value, criteria) = RawFunctionLayout::from_var(&mut env, var);
|
||||
debug_assert!(
|
||||
criteria.is_cacheable(),
|
||||
"{:?} not cacheable as top-level",
|
||||
value
|
||||
"{value:?} not cacheable as top-level"
|
||||
);
|
||||
value
|
||||
}
|
||||
|
@ -1485,9 +1483,7 @@ impl<'a> LambdaSet<'a> {
|
|||
{
|
||||
debug_assert!(
|
||||
self.contains(function_symbol),
|
||||
"function symbol {:?} not in set {:?}",
|
||||
function_symbol,
|
||||
self
|
||||
"function symbol {function_symbol:?} not in set {self:?}"
|
||||
);
|
||||
|
||||
let comparator = |other_name: Symbol, other_captures_layouts: &[InLayout<'a>]| {
|
||||
|
@ -3210,10 +3206,7 @@ fn layout_from_flat_type<'a>(
|
|||
Cacheable(Ok(boxed_layout), criteria)
|
||||
}
|
||||
_ => {
|
||||
panic!(
|
||||
"TODO layout_from_flat_type for Apply({:?}, {:?})",
|
||||
symbol, args
|
||||
);
|
||||
panic!("TODO layout_from_flat_type for Apply({symbol:?}, {args:?})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3664,7 +3657,7 @@ pub fn union_sorted_tags<'a>(
|
|||
|
||||
Error => return Err(LayoutProblem::Erroneous),
|
||||
|
||||
other => panic!("invalid content in tag union variable: {:?}", other),
|
||||
other => panic!("invalid content in tag union variable: {other:?}"),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -4387,7 +4380,7 @@ pub fn ext_var_is_empty_tag_union(subs: &Subs, tag_ext: TagExt) -> bool {
|
|||
}
|
||||
// So that we can continue compiling in the presence of errors
|
||||
Error => ext_fields.is_empty(),
|
||||
_ => panic!("invalid content in ext_var: {:?}", content),
|
||||
_ => panic!("invalid content in ext_var: {content:?}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4442,17 +4435,14 @@ fn layout_from_num_content<'a>(
|
|||
Symbol::NUM_DEC => Ok(Layout::DEC),
|
||||
|
||||
_ => {
|
||||
panic!(
|
||||
"Invalid Num.Num type application: Apply({:?}, {:?})",
|
||||
symbol, args
|
||||
);
|
||||
panic!("Invalid Num.Num type application: Apply({symbol:?}, {args:?})");
|
||||
}
|
||||
},
|
||||
Alias(_, _, _, _) => {
|
||||
todo!("TODO recursively resolve type aliases in num_from_content");
|
||||
}
|
||||
Structure(_) | RangedNumber(..) | LambdaSet(_) => {
|
||||
panic!("Invalid Num.Num type application: {:?}", content);
|
||||
panic!("Invalid Num.Num type application: {content:?}");
|
||||
}
|
||||
Error => Err(LayoutProblem::Erroneous),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue