mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Don't pass empty captures
This commit is contained in:
parent
13c45151a4
commit
fcb907b0c9
3 changed files with 13 additions and 9 deletions
|
@ -5287,9 +5287,13 @@ pub fn with_hole<'a>(
|
|||
unreachable!("a closure syntactically always must have at least one argument")
|
||||
}
|
||||
RawFunctionLayout::ErasedFunction(argument_layouts, ret_layout) => {
|
||||
let captured_symbols = Vec::from_iter_in(captured_symbols, env.arena);
|
||||
let captured_symbols = captured_symbols.into_bump_slice();
|
||||
let captured_symbols = CapturedSymbols::Captured(captured_symbols);
|
||||
let captured_symbols = if captured_symbols.is_empty() {
|
||||
CapturedSymbols::None
|
||||
} else {
|
||||
let captured_symbols = Vec::from_iter_in(captured_symbols, env.arena);
|
||||
let captured_symbols = captured_symbols.into_bump_slice();
|
||||
CapturedSymbols::Captured(captured_symbols)
|
||||
};
|
||||
let resolved_erased_lambda = ResolvedErasedLambda::new(
|
||||
env,
|
||||
layout_cache,
|
||||
|
|
|
@ -368,11 +368,13 @@ pub fn build_erased_function<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct ResolvedErasedCaptures<'a> {
|
||||
layouts: &'a [InLayout<'a>],
|
||||
symbols: &'a [Symbol],
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ResolvedErasedLambda<'a> {
|
||||
captures: Option<ResolvedErasedCaptures<'a>>,
|
||||
lambda_name: LambdaName<'a>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue