mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
turn vec into boxed slice
This commit is contained in:
parent
203c5b53be
commit
fd9d57d314
5 changed files with 12 additions and 7 deletions
|
@ -1642,7 +1642,11 @@ fn make_tag_union_recursive<'a>(
|
||||||
can_report_error,
|
can_report_error,
|
||||||
),
|
),
|
||||||
_ => {
|
_ => {
|
||||||
let problem = roc_types::types::Problem::CyclicAlias(symbol, region, others.clone());
|
let problem = roc_types::types::Problem::CyclicAlias(
|
||||||
|
symbol,
|
||||||
|
region,
|
||||||
|
others.clone().into_boxed_slice(),
|
||||||
|
);
|
||||||
*typ = Type::Erroneous(problem);
|
*typ = Type::Erroneous(problem);
|
||||||
|
|
||||||
// ensure cyclic error is only reported for one element of the cycle
|
// ensure cyclic error is only reported for one element of the cycle
|
||||||
|
|
|
@ -146,7 +146,7 @@ pub fn can_problem<'b>(
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Problem::CyclicAlias(symbol, region, others) => {
|
Problem::CyclicAlias(symbol, region, others) => {
|
||||||
let (doc, title) = crate::error::r#type::cyclic_alias(alloc, symbol, region, others);
|
let (doc, title) = crate::error::r#type::cyclic_alias(alloc, symbol, region, &*others);
|
||||||
|
|
||||||
return Report {
|
return Report {
|
||||||
title,
|
title,
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub fn type_problem<'b>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CyclicAlias(symbol, region, others) => {
|
CyclicAlias(symbol, region, others) => {
|
||||||
let (doc, title) = cyclic_alias(alloc, symbol, region, others);
|
let (doc, title) = cyclic_alias(alloc, symbol, region, &*others);
|
||||||
|
|
||||||
Report {
|
Report {
|
||||||
title,
|
title,
|
||||||
|
@ -110,7 +110,7 @@ pub fn cyclic_alias<'b>(
|
||||||
alloc: &'b RocDocAllocator<'b>,
|
alloc: &'b RocDocAllocator<'b>,
|
||||||
symbol: Symbol,
|
symbol: Symbol,
|
||||||
region: roc_region::all::Region,
|
region: roc_region::all::Region,
|
||||||
others: Vec<Symbol>,
|
others: &[Symbol],
|
||||||
) -> (RocDocBuilder<'b>, String) {
|
) -> (RocDocBuilder<'b>, String) {
|
||||||
let doc = if others.is_empty() {
|
let doc = if others.is_empty() {
|
||||||
alloc.stack(vec![
|
alloc.stack(vec![
|
||||||
|
@ -140,7 +140,7 @@ pub fn cyclic_alias<'b>(
|
||||||
alloc.symbol_unqualified(symbol),
|
alloc.symbol_unqualified(symbol),
|
||||||
others
|
others
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|other| alloc.symbol_unqualified(other))
|
.map(|other| alloc.symbol_unqualified(*other))
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
),
|
),
|
||||||
alloc.reflow("Recursion in aliases is only allowed if recursion happens behind a tag."),
|
alloc.reflow("Recursion in aliases is only allowed if recursion happens behind a tag."),
|
||||||
|
|
|
@ -4497,8 +4497,9 @@ mod solve_expr {
|
||||||
std::mem::size_of::<roc_types::subs::Content>(),
|
std::mem::size_of::<roc_types::subs::Content>(),
|
||||||
std::mem::size_of::<roc_types::subs::FlatType>(),
|
std::mem::size_of::<roc_types::subs::FlatType>(),
|
||||||
std::mem::size_of::<roc_types::types::Problem>(),
|
std::mem::size_of::<roc_types::types::Problem>(),
|
||||||
|
std::mem::size_of::<roc_module::ident::Ident>(),
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(query, (40, 96, 80, 72, 64))
|
assert_eq!(query, (40, 96, 80, 72, 64, 32))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1117,7 +1117,7 @@ pub struct Alias {
|
||||||
pub enum Problem {
|
pub enum Problem {
|
||||||
CanonicalizationProblem,
|
CanonicalizationProblem,
|
||||||
CircularType(Symbol, Box<ErrorType>, Region),
|
CircularType(Symbol, Box<ErrorType>, Region),
|
||||||
CyclicAlias(Symbol, Region, Vec<Symbol>),
|
CyclicAlias(Symbol, Region, Box<[Symbol]>),
|
||||||
UnrecognizedIdent(InlinableString),
|
UnrecognizedIdent(InlinableString),
|
||||||
Shadowed(Region, Located<Ident>),
|
Shadowed(Region, Located<Ident>),
|
||||||
BadTypeArguments {
|
BadTypeArguments {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue