diff --git a/compiler/load_internal/src/file.rs b/compiler/load_internal/src/file.rs index c64b9c738e..9259818027 100644 --- a/compiler/load_internal/src/file.rs +++ b/compiler/load_internal/src/file.rs @@ -4513,7 +4513,7 @@ fn to_file_problem_report(filename: &Path, error: io::ErrorKind) -> String { let report = match error { io::ErrorKind::NotFound => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am looking for this file, but it's not there:"), alloc .parser_suggestion(filename.to_str().unwrap()) @@ -4532,7 +4532,7 @@ fn to_file_problem_report(filename: &Path, error: io::ErrorKind) -> String { } } io::ErrorKind::PermissionDenied => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I don't have the required permissions to read this file:"), alloc .parser_suggestion(filename.to_str().unwrap()) @@ -4630,7 +4630,7 @@ fn to_missing_platform_report(module_id: ModuleId, other: PlatformPath) -> Strin match other { Valid(_) => unreachable!(), NotSpecified => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow("I could not find a platform based on your input file."), alloc.reflow(r"Does the module header contain an entry that looks like this:"), alloc @@ -4647,7 +4647,7 @@ fn to_missing_platform_report(module_id: ModuleId, other: PlatformPath) -> Strin } } RootIsInterface => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"The input file is an interface module, but only app modules can be ran."), alloc.concat([ alloc.reflow(r"I will still parse and typecheck the input file and its dependencies, "), @@ -4663,7 +4663,7 @@ fn to_missing_platform_report(module_id: ModuleId, other: PlatformPath) -> Strin } } RootIsHosted => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"The input file is a hosted module, but only app modules can be ran."), alloc.concat([ alloc.reflow(r"I will still parse and typecheck the input file and its dependencies, "), @@ -4679,7 +4679,7 @@ fn to_missing_platform_report(module_id: ModuleId, other: PlatformPath) -> Strin } } RootIsPkgConfig => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"The input file is a package config file, but only app modules can be ran."), alloc.concat([ alloc.reflow(r"I will still parse and typecheck the input file and its dependencies, "), diff --git a/reporting/src/error/canonicalize.rs b/reporting/src/error/canonicalize.rs index d22c091a4b..4e627cb2dc 100644 --- a/reporting/src/error/canonicalize.rs +++ b/reporting/src/error/canonicalize.rs @@ -61,7 +61,7 @@ pub fn can_problem<'b>( let line = r#" then remove it so future readers of your code don't wonder why it is there."#; - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc .symbol_unqualified(symbol) .append(alloc.reflow(" is not used anywhere in your code.")), @@ -76,7 +76,7 @@ pub fn can_problem<'b>( severity = Severity::Warning; } Problem::UnusedImport(module_id, region) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("Nothing from "), alloc.module(module_id), @@ -94,7 +94,7 @@ pub fn can_problem<'b>( severity = Severity::Warning; } Problem::ExposedButNotDefined(symbol) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.symbol_unqualified(symbol).append( alloc.reflow(" is listed as exposed, but it isn't defined in this module."), ), @@ -110,7 +110,7 @@ pub fn can_problem<'b>( severity = Severity::RuntimeError; } Problem::UnknownGeneratesWith(loc_ident) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc .reflow("I don't know how to generate the ") .append(alloc.ident(loc_ident.value)) @@ -127,7 +127,7 @@ pub fn can_problem<'b>( Problem::UnusedArgument(closure_symbol, argument_symbol, region) => { let line = "\". Adding an underscore at the start of a variable name is a way of saying that the variable is not used."; - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.symbol_unqualified(closure_symbol), alloc.reflow(" doesn't use "), @@ -152,7 +152,7 @@ pub fn can_problem<'b>( severity = Severity::Warning; } Problem::PrecedenceProblem(BothNonAssociative(region, left_bin_op, right_bin_op)) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ if left_bin_op.value == right_bin_op.value { alloc.concat([ alloc.reflow("Using more than one "), @@ -181,7 +181,7 @@ pub fn can_problem<'b>( severity = Severity::RuntimeError; } Problem::UnsupportedPattern(BadPattern::UnderscoreInDef, region) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.reflow("Underscore patterns are not allowed in definitions"), alloc.region(lines.convert_region(region)), ]); @@ -209,7 +209,7 @@ pub fn can_problem<'b>( alloc.reflow(" instead."), ]; - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc .reflow("This pattern is not allowed in ") .append(alloc.reflow(this_thing)), @@ -242,7 +242,7 @@ pub fn can_problem<'b>( variable_region, variable_name, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("The "), alloc.type_variable(variable_name), @@ -310,7 +310,7 @@ pub fn can_problem<'b>( record_region, replaced_region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This record defines the "), alloc.record_field(field_name.clone()), @@ -359,7 +359,7 @@ pub fn can_problem<'b>( record_region, replaced_region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This record type defines the "), alloc.record_field(field_name.clone()), @@ -394,7 +394,7 @@ pub fn can_problem<'b>( tag_region, replaced_region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This tag union type defines the "), alloc.tag_name(tag_name.clone()), @@ -427,7 +427,7 @@ pub fn can_problem<'b>( ref annotation_pattern, ref def_pattern, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.reflow( "This annotation does not match the definition immediately following it:", ), @@ -444,7 +444,7 @@ pub fn can_problem<'b>( alias_name: type_name, region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This pattern in the definition of "), alloc.symbol_unqualified(type_name), @@ -464,7 +464,7 @@ pub fn can_problem<'b>( severity = Severity::RuntimeError; } Problem::InvalidHexadecimal(region) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.reflow("This unicode code point is invalid:"), alloc.region(lines.convert_region(region)), alloc.concat([ @@ -481,7 +481,7 @@ pub fn can_problem<'b>( severity = Severity::RuntimeError; } Problem::InvalidUnicodeCodePt(region) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.reflow("This unicode code point is invalid:"), alloc.region(lines.convert_region(region)), alloc.reflow("Learn more about working with unicode in roc at TODO"), @@ -491,7 +491,7 @@ pub fn can_problem<'b>( severity = Severity::RuntimeError; } Problem::InvalidInterpolation(region) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.reflow("This string interpolation is invalid:"), alloc.region(lines.convert_region(region)), alloc.concat([ @@ -519,7 +519,7 @@ pub fn can_problem<'b>( def_region, differing_recursion_region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.symbol_unqualified(alias), alloc.reflow(" is a nested datatype. Here is one recursive usage of it:"), @@ -551,7 +551,7 @@ pub fn can_problem<'b>( } }; - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This "), alloc.text(kind_str), @@ -575,7 +575,7 @@ pub fn can_problem<'b>( name, variables_region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("The definition of the "), alloc.symbol_unqualified(name), @@ -593,7 +593,7 @@ pub fn can_problem<'b>( Problem::HasClauseIsNotAbility { region: clause_region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.reflow(r#"The type referenced in this "has" clause is not an ability:"#), alloc.region(lines.convert_region(clause_region)), ]); @@ -608,7 +608,7 @@ pub fn can_problem<'b>( }, ability, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("The definition of the "), alloc.symbol_unqualified(name), @@ -633,7 +633,7 @@ pub fn can_problem<'b>( } Problem::IllegalHasClause { region } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("A "), alloc.keyword("has"), @@ -654,7 +654,7 @@ pub fn can_problem<'b>( ability, region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("The definition of the ability member "), alloc.symbol_unqualified(member), @@ -690,7 +690,7 @@ pub fn can_problem<'b>( span_has_clauses, mut bound_var_names, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("The definition of the ability member "), alloc.symbol_unqualified(member), @@ -717,7 +717,7 @@ pub fn can_problem<'b>( ability, region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("The definition of the ability member "), alloc.symbol_unqualified(member), @@ -776,7 +776,7 @@ fn to_invalid_optional_value_report_help<'b>( field_region: Region, record_region: Region, ) -> RocDocBuilder<'b> { - alloc.stack(vec![ + alloc.stack([ alloc.concat([ alloc.reflow("This record uses an optional value for the "), alloc.record_field(field_name), @@ -808,7 +808,7 @@ fn to_bad_ident_expr_report<'b>( WeirdDotAccess(pos) | StrayDot(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - alloc.stack(vec![ + alloc.stack([ alloc.reflow(r"I trying to parse a record field access here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -821,7 +821,7 @@ fn to_bad_ident_expr_report<'b>( ]) } - WeirdAccessor(_pos) => alloc.stack(vec![ + WeirdAccessor(_pos) => alloc.stack([ alloc.reflow("I am very confused by this field access"), alloc.region(lines.convert_region(surroundings)), alloc.concat([ @@ -839,7 +839,7 @@ fn to_bad_ident_expr_report<'b>( WeirdDotQualified(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - alloc.stack(vec![ + alloc.stack([ alloc.reflow("I am trying to parse a qualified name here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -854,7 +854,7 @@ fn to_bad_ident_expr_report<'b>( QualifiedTag(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - alloc.stack(vec![ + alloc.stack([ alloc.reflow("I am trying to parse a qualified name here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -869,7 +869,7 @@ fn to_bad_ident_expr_report<'b>( Underscore(pos) => { let region = Region::new(surroundings.start(), pos); - alloc.stack(vec![ + alloc.stack([ alloc.reflow("Underscores are not allowed in identifier names:"), alloc.region_with_subregion( lines.convert_region(surroundings), @@ -891,7 +891,7 @@ fn to_bad_ident_expr_report<'b>( match what_is_next(alloc.src_lines, lines.convert_pos(pos)) { LowercaseAccess(width) => { let region = Region::new(pos, pos.bump_column(width)); - alloc.stack(vec![ + alloc.stack([ alloc.reflow("I am very confused by this field access:"), alloc.region_with_subregion( lines.convert_region(surroundings), @@ -906,7 +906,7 @@ fn to_bad_ident_expr_report<'b>( } UppercaseAccess(width) => { let region = Region::new(pos, pos.bump_column(width)); - alloc.stack(vec![ + alloc.stack([ alloc.reflow("I am very confused by this expression:"), alloc.region_with_subregion( lines.convert_region(surroundings), @@ -925,7 +925,7 @@ fn to_bad_ident_expr_report<'b>( Other(Some(c)) if c.is_lowercase() => { let region = Region::new(surroundings.start().bump_column(1), pos.bump_column(1)); - alloc.stack(vec![ + alloc.stack([ alloc.concat([ alloc.reflow("I am trying to parse "), alloc.reflow(kind), @@ -967,7 +967,7 @@ fn to_bad_ident_pattern_report<'b>( WeirdDotAccess(pos) | StrayDot(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - alloc.stack(vec![ + alloc.stack([ alloc.reflow(r"I trying to parse a record field accessor here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -980,7 +980,7 @@ fn to_bad_ident_pattern_report<'b>( ]) } - WeirdAccessor(_pos) => alloc.stack(vec![ + WeirdAccessor(_pos) => alloc.stack([ alloc.reflow("I am very confused by this field access"), alloc.region(lines.convert_region(surroundings)), alloc.concat([ @@ -998,7 +998,7 @@ fn to_bad_ident_pattern_report<'b>( WeirdDotQualified(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - alloc.stack(vec![ + alloc.stack([ alloc.reflow("I am trying to parse a qualified name here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -1013,7 +1013,7 @@ fn to_bad_ident_pattern_report<'b>( QualifiedTag(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - alloc.stack(vec![ + alloc.stack([ alloc.reflow("I am trying to parse a qualified name here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -1029,7 +1029,7 @@ fn to_bad_ident_pattern_report<'b>( Underscore(pos) => { let region = Region::from_pos(pos.sub(1)); - alloc.stack(vec![ + alloc.stack([ alloc.reflow("I am trying to parse an identifier here:"), alloc.region_with_subregion( lines.convert_region(surroundings), @@ -1122,7 +1122,7 @@ fn report_shadowing<'b>( ShadowKind::Ability => "abilities", }; - alloc.stack(vec![ + alloc.stack([ alloc .text("The ") .append(alloc.ident(shadow.value)) @@ -1217,7 +1217,7 @@ fn pretty_runtime_error<'b>( ), }; - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This"), alloc.text(name), @@ -1251,12 +1251,12 @@ fn pretty_runtime_error<'b>( let qualified_suggestions = suggestions .into_iter() .map(|v| alloc.string(module_name.to_string() + "." + v.as_str())); - alloc.stack(vec![ + alloc.stack([ alloc.reflow("Did you mean one of these?"), alloc.vcat(qualified_suggestions).indent(4), ]) }; - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("The "), alloc.module_name(module_name), @@ -1298,7 +1298,7 @@ fn pretty_runtime_error<'b>( title = SYNTAX_PROBLEM; } RuntimeError::MalformedTypeName(_box_str, surroundings) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.reflow(r"I am confused by this type name:"), alloc.region(lines.convert_region(surroundings)), alloc.concat([ @@ -1328,7 +1328,7 @@ fn pretty_runtime_error<'b>( "small" }; - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This float literal is too "), alloc.text(big_or_small), @@ -1352,7 +1352,7 @@ fn pretty_runtime_error<'b>( .tip() .append(alloc.reflow("Learn more about number literals at TODO")); - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This float literal contains an invalid digit:"), ]), @@ -1366,7 +1366,7 @@ fn pretty_runtime_error<'b>( title = SYNTAX_PROBLEM; } RuntimeError::InvalidFloat(FloatErrorKind::IntSuffix, region, _raw_str) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc .concat([alloc .reflow("This number literal is a float, but it has an integer suffix:")]), @@ -1416,7 +1416,7 @@ fn pretty_runtime_error<'b>( .tip() .append(alloc.reflow("Learn more about number literals at TODO")); - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This "), alloc.text(name), @@ -1466,7 +1466,7 @@ fn pretty_runtime_error<'b>( .tip() .append(alloc.reflow("Learn more about number literals at TODO")); - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This integer literal is too "), alloc.text(big_or_small), @@ -1480,7 +1480,7 @@ fn pretty_runtime_error<'b>( title = SYNTAX_PROBLEM; } RuntimeError::InvalidInt(IntErrorKind::FloatSuffix, _base, region, _raw_str) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc .concat([alloc .reflow("This number literal is an integer, but it has a float suffix:")]), @@ -1498,7 +1498,7 @@ fn pretty_runtime_error<'b>( region, _raw_str, ) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([alloc .reflow("This integer literal overflows the type indicated by its suffix:")]), alloc.region(lines.convert_region(region)), @@ -1522,7 +1522,7 @@ fn pretty_runtime_error<'b>( region, _raw_str, ) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([alloc .reflow("This integer literal underflows the type indicated by its suffix:")]), alloc.region(lines.convert_region(region)), @@ -1553,7 +1553,7 @@ fn pretty_runtime_error<'b>( title = SYNTAX_PROBLEM; } RuntimeError::InvalidRecordUpdate { region } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This expression cannot be updated"), alloc.reflow(":"), @@ -1589,13 +1589,11 @@ fn pretty_runtime_error<'b>( unreachable!("not currently reported (but can blow up at runtime)") } RuntimeError::ExposedButNotDefined(symbol) => { - doc = alloc.stack(vec![alloc + doc = alloc.stack([alloc .symbol_unqualified(symbol) .append(alloc.reflow(" was listed as exposed in ")) .append(alloc.module(symbol.module_id())) - .append( - alloc.reflow(", but it was not defined anywhere in that module."), - )]); + .append(alloc.reflow(", but it was not defined anywhere in that module."))]); title = MISSING_DEFINITION; } @@ -1604,7 +1602,7 @@ fn pretty_runtime_error<'b>( .tip() .append(alloc.reflow("Learn more about character literals at TODO")); - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([alloc.reflow("This character literal is empty.")]), alloc.region(lines.convert_region(region)), tip, @@ -1617,7 +1615,7 @@ fn pretty_runtime_error<'b>( .tip() .append(alloc.reflow("Learn more about character literals at TODO")); - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("This character literal contains more than one code point.") ]), @@ -1648,7 +1646,7 @@ fn pretty_runtime_error<'b>( } else { let qualified_suggestions = suggestions.into_iter().map(|v| alloc.string(v.to_string())); - alloc.stack(vec![ + alloc.stack([ alloc .tip() .append(alloc.reflow("Did you mean one of these opaque types?")), @@ -1666,7 +1664,7 @@ fn pretty_runtime_error<'b>( ]; if let Some(defined_alias_region) = opt_defined_alias { - stack.push(alloc.stack(vec![ + stack.push(alloc.stack([ alloc.note("There is an alias of the same name:"), alloc.region(lines.convert_region(defined_alias_region)), ])); @@ -1683,7 +1681,7 @@ fn pretty_runtime_error<'b>( referenced_region, imported_region, } => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.concat([ alloc.reflow("The unwrapped opaque type "), alloc.type_str(opaque.as_inline_str().as_str()), @@ -1700,7 +1698,7 @@ fn pretty_runtime_error<'b>( title = OPAQUE_DECLARED_OUTSIDE_SCOPE; } RuntimeError::OpaqueNotApplied(loc_ident) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.reflow("This opaque type is not applied to an argument:"), alloc.region(lines.convert_region(loc_ident.region)), alloc.note("Opaque types always wrap exactly one argument!"), @@ -1709,7 +1707,7 @@ fn pretty_runtime_error<'b>( title = OPAQUE_NOT_APPLIED; } RuntimeError::OpaqueAppliedToMultipleArgs(region) => { - doc = alloc.stack(vec![ + doc = alloc.stack([ alloc.reflow("This opaque type is applied to multiple arguments:"), alloc.region(lines.convert_region(region)), alloc.note("Opaque types always wrap exactly one argument!"), @@ -1738,7 +1736,7 @@ fn to_circular_def_doc<'b>( " value is defined directly in terms of itself, causing an infinite loop.", )), [first, others @ ..] => { - alloc.stack(vec![ + alloc.stack([ alloc .reflow("The ") .append(alloc.symbol_unqualified(first.symbol)) @@ -1793,7 +1791,7 @@ fn not_found<'b>( if suggestions.is_empty() { no_suggestion_details } else { - alloc.stack(vec![ + alloc.stack([ yes_suggestion_details, alloc .vcat(suggestions.into_iter().map(|v| alloc.string(v.to_string()))) @@ -1802,7 +1800,7 @@ fn not_found<'b>( } }; - alloc.stack(vec![ + alloc.stack([ alloc.concat([ alloc.reflow("I cannot find a `"), alloc.string(name.to_string()), @@ -1845,7 +1843,7 @@ fn module_not_found<'b>( alloc.reflow(" missing up-top"), ]) } else { - alloc.stack(vec![ + alloc.stack([ alloc.reflow("Is there an import missing? Perhaps there is a typo. Did you mean one of these?"), alloc .vcat(suggestions.into_iter().map(|v| alloc.string(v.to_string()))) @@ -1854,7 +1852,7 @@ fn module_not_found<'b>( } }; - alloc.stack(vec![ + alloc.stack([ alloc.concat([ alloc.reflow("The `"), alloc.string(name.to_string()), diff --git a/reporting/src/error/mono.rs b/reporting/src/error/mono.rs index 691e9b31cc..7ca6608c7d 100644 --- a/reporting/src/error/mono.rs +++ b/reporting/src/error/mono.rs @@ -17,7 +17,7 @@ pub fn mono_problem<'b>( match problem { PatternProblem(Incomplete(region, context, missing)) => match context { BadArg => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow("This pattern does not cover all the possibilities:"), alloc.region(lines.convert_region(region)), alloc.reflow("Other possibilities include:"), @@ -40,7 +40,7 @@ pub fn mono_problem<'b>( } } BadDestruct => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow("This pattern does not cover all the possibilities:"), alloc.region(lines.convert_region(region)), alloc.reflow("Other possibilities include:"), @@ -64,7 +64,7 @@ pub fn mono_problem<'b>( } } BadCase => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow("This "), alloc.keyword("when"), @@ -93,7 +93,7 @@ pub fn mono_problem<'b>( branch_region, index, }) => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow("The "), alloc.string(index.ordinal()), diff --git a/reporting/src/error/parse.rs b/reporting/src/error/parse.rs index 63581bff7a..c46a03aea1 100644 --- a/reporting/src/error/parse.rs +++ b/reporting/src/error/parse.rs @@ -74,7 +74,7 @@ fn to_syntax_report<'a>( match parse_problem { SyntaxError::ArgumentsBeforeEquals(region) => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow("Unexpected tokens in front of the `=` symbol:"), alloc.region(lines.convert_region(*region)), ]); @@ -92,7 +92,7 @@ fn to_syntax_report<'a>( region = LineColumnRegion::new(region.start(), region.end().bump_column(1)); } - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow("Unexpected token "), // context(alloc, &parse_problem.context_stack, "here"), @@ -106,7 +106,7 @@ fn to_syntax_report<'a>( NotEndOfFile(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I expected to reach the end of the file, but got stuck here:"), alloc.region(region), ]); @@ -119,7 +119,7 @@ fn to_syntax_report<'a>( } } SyntaxError::Eof(region) => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow("End of Field"), alloc.region(lines.convert_region(*region)), ]); @@ -132,7 +132,7 @@ fn to_syntax_report<'a>( } } SyntaxError::OutdentedTooFar => { - let doc = alloc.stack(vec![alloc.reflow("OutdentedTooFar")]); + let doc = alloc.stack([alloc.reflow("OutdentedTooFar")]); Report { filename, @@ -202,7 +202,7 @@ fn to_expr_report<'a>( let surroundings = Region::new(start, *pos); let region = lines.convert_region(*region); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a definition, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -240,7 +240,7 @@ fn to_expr_report<'a>( alloc.parser_suggestion("Str.concat"), alloc.reflow(" instead."), ], - ":" => vec![alloc.stack(vec![ + ":" => vec![alloc.stack([ alloc.concat([ alloc.reflow("The has-type operator "), alloc.parser_suggestion(":"), @@ -258,7 +258,7 @@ fn to_expr_report<'a>( return to_unexpected_arrow_report(alloc, lines, filename, *pos, start); } _ => { - vec![alloc.stack(vec![ + vec![alloc.stack([ alloc.concat([ alloc.reflow("The arrow "), alloc.parser_suggestion("->"), @@ -291,7 +291,7 @@ fn to_expr_report<'a>( ], }; - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"This looks like an operator, but it's not one I recognize!"), alloc.region_with_subregion( lines.convert_region(surroundings), @@ -314,7 +314,7 @@ fn to_expr_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am very confused by this identifier:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -348,7 +348,7 @@ fn to_expr_report<'a>( ), Context::InDefFinalExpr { .. } => ( "MISSING FINAL EXPRESSION", - alloc.stack(vec![ + alloc.stack([ alloc.concat([ alloc.reflow("This definition is missing a final expression."), alloc.reflow(" A nested definition must be followed by"), @@ -396,7 +396,7 @@ fn to_expr_report<'a>( let surroundings = Region::new(context_pos, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow(r"I am partway through parsing "), a_thing, @@ -418,7 +418,7 @@ fn to_expr_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a definition, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -455,7 +455,7 @@ fn to_expr_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -477,7 +477,7 @@ fn to_expr_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a definition, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -500,7 +500,7 @@ fn to_expr_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing an expression, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([alloc.reflow("Looks like you are trying to define a function. ")]), @@ -518,7 +518,7 @@ fn to_expr_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing an record, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([alloc.reflow("TODO provide more context.")]), @@ -560,7 +560,7 @@ fn to_lambda_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -582,7 +582,7 @@ fn to_lambda_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -607,7 +607,7 @@ fn to_lambda_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -629,7 +629,7 @@ fn to_lambda_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -654,7 +654,7 @@ fn to_lambda_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck at this comma:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -675,7 +675,7 @@ fn to_lambda_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -757,7 +757,7 @@ fn to_unfinished_lambda_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow(r"I was partway through parsing a "), alloc.reflow(r" function, but I got stuck here:"), @@ -806,7 +806,7 @@ fn to_str_report<'a>( .append(alloc.parser_suggestion(sugg)) }; - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow(r"I was partway through parsing a "), alloc.reflow(r" string literal, but I got stuck here:"), @@ -843,7 +843,7 @@ fn to_str_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a unicode code point, but I got stuck here:", ), @@ -869,7 +869,7 @@ fn to_str_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I cannot find the end of this format expression:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -890,7 +890,7 @@ fn to_str_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I cannot find the end of this string:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -913,7 +913,7 @@ fn to_str_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I cannot find the end of this block string:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -958,7 +958,7 @@ fn to_expr_in_parens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow("I am partway through parsing a record pattern, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -982,7 +982,7 @@ fn to_expr_in_parens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I just started parsing an expression in parentheses, but I got stuck here:", ), @@ -1034,7 +1034,7 @@ fn to_list_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through started parsing a list, but I got stuck here:", ), @@ -1057,7 +1057,7 @@ fn to_list_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through started parsing a list, but I got stuck here:", ), @@ -1093,7 +1093,7 @@ fn to_list_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I cannot find the end of this list:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -1212,7 +1212,7 @@ fn to_unfinished_if_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow(r"I was partway through parsing an "), alloc.keyword("if"), @@ -1247,7 +1247,7 @@ fn to_when_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I just started parsing an if guard, but there is no guard condition:", ), @@ -1276,7 +1276,7 @@ fn to_when_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow(r"I am partway through parsing a "), alloc.keyword("when"), @@ -1431,7 +1431,7 @@ fn to_unfinished_when_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow(r"I was partway through parsing a "), alloc.keyword("when"), @@ -1462,7 +1462,7 @@ fn to_unexpected_arrow_report<'a>( let surroundings = Region::new(start, pos); let region = Region::new(pos, pos.bump_column(2)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow(r"I am parsing a "), alloc.keyword("when"), @@ -1491,7 +1491,7 @@ fn to_unexpected_arrow_report<'a>( } fn note_for_when_error<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> { - alloc.stack(vec![ + alloc.stack([ alloc.concat([ alloc.note("Here is an example of a valid "), alloc.keyword("when"), @@ -1515,7 +1515,7 @@ fn note_for_when_error<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> } fn note_for_when_indent_error<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> { - alloc.stack(vec![ + alloc.stack([ alloc.concat([ alloc.note("Sometimes I get confused by indentation, so try to make your "), alloc.keyword("when"), @@ -1552,7 +1552,7 @@ fn to_pattern_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a pattern, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.note("I may be confused by indentation"), @@ -1591,7 +1591,7 @@ fn to_precord_report<'a>( let surroundings = Region::new(start, pos); let region = to_keyword_region(lines.convert_pos(pos), keyword); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record pattern, but I got stuck on this field name:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -1612,7 +1612,7 @@ fn to_precord_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record pattern, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), record_patterns_look_like(alloc), @@ -1633,7 +1633,7 @@ fn to_precord_report<'a>( match what_is_next(alloc.src_lines, lines.convert_pos(pos)) { Next::Other(Some(c)) if c.is_alphabetic() => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a record pattern, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -1651,7 +1651,7 @@ fn to_precord_report<'a>( } } _ => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow("I am partway through parsing a record pattern, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -1678,7 +1678,7 @@ fn to_precord_report<'a>( let surroundings = Region::new(start, pos); let region = to_keyword_region(lines.convert_pos(pos), keyword); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record pattern, but I got stuck on this field name:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -1701,7 +1701,7 @@ fn to_precord_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a record pattern, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -1748,7 +1748,7 @@ fn to_precord_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record pattern, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), record_patterns_look_like(alloc), @@ -1769,7 +1769,7 @@ fn to_precord_report<'a>( let surroundings = LineColumnRegion::new(lines.convert_pos(start), curly_pos); let region = LineColumnRegion::from_pos(curly_pos); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( "I am partway through parsing a record pattern, but I got stuck here:", ), @@ -1790,7 +1790,7 @@ fn to_precord_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a record pattern, but I got stuck here:", ), @@ -1841,7 +1841,7 @@ fn to_pattern_in_parens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I just started parsing a pattern in parentheses, but I got stuck here:", ), @@ -1867,7 +1867,7 @@ fn to_pattern_in_parens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow("I am partway through parsing a pattern in parentheses, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -1893,7 +1893,7 @@ fn to_pattern_in_parens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I just started parsing a pattern in parentheses, but I got stuck here:", ), @@ -1916,7 +1916,7 @@ fn to_pattern_in_parens_report<'a>( let surroundings = LineColumnRegion::new(lines.convert_pos(start), curly_pos); let region = LineColumnRegion::from_pos(curly_pos); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( "I am partway through parsing a pattern in parentheses, but I got stuck here:", ), @@ -1937,7 +1937,7 @@ fn to_pattern_in_parens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a pattern in parentheses, but I got stuck here:", ), @@ -1974,7 +1974,7 @@ fn to_malformed_number_literal_report<'a>( let surroundings = Region::new(start, start); let region = LineColumnRegion::from_pos(lines.convert_pos(start)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"This number literal is malformed:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), ]); @@ -2013,7 +2013,7 @@ fn to_type_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a function argument type, but I encountered two commas in a row:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([alloc.reflow("Try removing one of them.")]), @@ -2034,7 +2034,7 @@ fn to_type_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2058,7 +2058,7 @@ fn to_type_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.note("I may be confused by indentation"), @@ -2076,7 +2076,7 @@ fn to_type_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.note("I may be confused by indentation"), @@ -2094,7 +2094,7 @@ fn to_type_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing an inline type alias, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.note("I may be confused by indentation"), @@ -2112,7 +2112,7 @@ fn to_type_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am expecting a type variable, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), ]); @@ -2144,7 +2144,7 @@ fn to_trecord_report<'a>( let surroundings = Region::new(start, pos); let region = to_keyword_region(lines.convert_pos(pos), keyword); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record type, but I got stuck on this field name:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2165,7 +2165,7 @@ fn to_trecord_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2190,7 +2190,7 @@ fn to_trecord_report<'a>( match what_is_next(alloc.src_lines, lines.convert_pos(pos)) { Next::Other(Some(c)) if c.is_alphabetic() => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a record type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2208,7 +2208,7 @@ fn to_trecord_report<'a>( } } _ => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow("I am partway through parsing a record type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2235,7 +2235,7 @@ fn to_trecord_report<'a>( let surroundings = Region::new(start, pos); let region = to_keyword_region(lines.convert_pos(pos), keyword); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record type, but I got stuck on this field name:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2258,7 +2258,7 @@ fn to_trecord_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a record type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2292,7 +2292,7 @@ fn to_trecord_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2317,7 +2317,7 @@ fn to_trecord_report<'a>( let surroundings = LineColumnRegion::new(lines.convert_pos(start), curly_pos); let region = LineColumnRegion::from_pos(curly_pos); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( "I am partway through parsing a record type, but I got stuck here:", ), @@ -2338,7 +2338,7 @@ fn to_trecord_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a record type, but I got stuck here:", ), @@ -2389,7 +2389,7 @@ fn to_ttag_union_report<'a>( let surroundings = Region::new(start, pos); let region = to_keyword_region(lines.convert_pos(pos), keyword); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a tag union, but I got stuck on this field name:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2412,7 +2412,7 @@ fn to_ttag_union_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a tag union type, but I got stuck here:", ), @@ -2432,7 +2432,7 @@ fn to_ttag_union_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a tag union type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2459,7 +2459,7 @@ fn to_ttag_union_report<'a>( Next::Other(Some(c)) if c.is_alphabetic() => { debug_assert!(c.is_lowercase()); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a tag union type, but I got stuck here:", ), @@ -2476,7 +2476,7 @@ fn to_ttag_union_report<'a>( } } Next::Other(Some('@')) => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a tag union type, but I got stuck here:", ), @@ -2493,7 +2493,7 @@ fn to_ttag_union_report<'a>( } } _ => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a tag union type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2521,7 +2521,7 @@ fn to_ttag_union_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just started parsing a tag union type, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2549,7 +2549,7 @@ fn to_ttag_union_report<'a>( let surroundings = LineColumnRegion::new(lines.convert_pos(start), curly_pos); let region = LineColumnRegion::from_pos(curly_pos); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( "I am partway through parsing a tag union type, but I got stuck here:", ), @@ -2570,7 +2570,7 @@ fn to_ttag_union_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a tag union type, but I got stuck here:", ), @@ -2614,7 +2614,7 @@ fn to_tinparens_report<'a>( let surroundings = Region::new(start, pos); let region = to_keyword_region(lines.convert_pos(pos), keyword); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I just saw an open parenthesis, so I was expecting to see a type next."), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2638,7 +2638,7 @@ fn to_tinparens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a type in parentheses, but I got stuck here:", ), @@ -2658,7 +2658,7 @@ fn to_tinparens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I just started parsing a type in parentheses, but I got stuck here:", ), @@ -2689,7 +2689,7 @@ fn to_tinparens_report<'a>( debug_assert!(c.is_lowercase()); // TODO hint for tuples? - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a type in parentheses, but I got stuck here:", ), @@ -2706,7 +2706,7 @@ fn to_tinparens_report<'a>( } } _ => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a type in parentheses, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -2734,7 +2734,7 @@ fn to_tinparens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow(r"I just started parsing a type in parentheses, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -2760,7 +2760,7 @@ fn to_tinparens_report<'a>( let surroundings = LineColumnRegion::new(lines.convert_pos(start), curly_pos); let region = LineColumnRegion::from_pos(curly_pos); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( "I am partway through parsing a type in parentheses, but I got stuck here:", ), @@ -2781,7 +2781,7 @@ fn to_tinparens_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I am partway through parsing a type in parentheses, but I got stuck here:", ), @@ -2822,7 +2822,7 @@ fn to_tapply_report<'a>( ETypeApply::DoubleDot(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I encountered two dots in a row:"), alloc.region(region), alloc.concat([alloc.reflow("Try removing one of them.")]), @@ -2838,7 +2838,7 @@ fn to_tapply_report<'a>( ETypeApply::TrailingDot(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I encountered a dot with nothing after it:"), alloc.region(region), alloc.concat([ @@ -2860,7 +2860,7 @@ fn to_tapply_report<'a>( ETypeApply::StartIsNumber(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I encountered a number at the start of a qualified name segment:"), alloc.region(region), alloc.concat([ @@ -2882,7 +2882,7 @@ fn to_tapply_report<'a>( ETypeApply::StartNotUppercase(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I encountered a lowercase letter at the start of a qualified name segment:"), alloc.region(region), alloc.concat([ @@ -2905,7 +2905,7 @@ fn to_tapply_report<'a>( ETypeApply::End(pos) => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow( r"I reached the end of the input file while parsing a qualified type name", ), @@ -2936,7 +2936,7 @@ fn to_talias_report<'a>( ETypeInlineAlias::NotAnAlias(pos) => { let region = Region::from_pos(pos); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow("The inline type after this "), alloc.keyword("as"), @@ -2962,7 +2962,7 @@ fn to_talias_report<'a>( ETypeInlineAlias::Qualified(pos) => { let region = Region::from_pos(pos); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"This type alias has a qualified name:"), alloc.region(lines.convert_region(region)), alloc.reflow("An alias introduces a new name to the current scope, so it must be unqualified."), @@ -2978,7 +2978,7 @@ fn to_talias_report<'a>( ETypeInlineAlias::ArgumentNotLowercase(pos) => { let region = Region::from_pos(pos); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"This alias type argument is not lowercase:"), alloc.region(lines.convert_region(region)), alloc.reflow("All type arguments must be lowercase."), @@ -3024,7 +3024,7 @@ fn to_header_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([alloc.reflow("I may be confused by indentation.")]), @@ -3042,7 +3042,7 @@ fn to_header_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am expecting a header, but got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3068,7 +3068,7 @@ fn to_header_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3092,7 +3092,7 @@ fn to_header_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3116,7 +3116,7 @@ fn to_header_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3139,7 +3139,7 @@ fn to_header_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3177,7 +3177,7 @@ fn to_generates_with_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a provides list, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -3201,7 +3201,7 @@ fn to_generates_with_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3243,7 +3243,7 @@ fn to_provides_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a provides list, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), @@ -3267,7 +3267,7 @@ fn to_provides_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3309,7 +3309,7 @@ fn to_exposes_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing an `exposes` list, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([alloc.reflow( @@ -3332,7 +3332,7 @@ fn to_exposes_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3373,7 +3373,7 @@ fn to_imports_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a imports list, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([alloc.reflow( @@ -3396,7 +3396,7 @@ fn to_imports_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3423,7 +3423,7 @@ fn to_imports_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3461,7 +3461,7 @@ fn to_requires_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3488,7 +3488,7 @@ fn to_requires_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3513,7 +3513,7 @@ fn to_requires_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3542,7 +3542,7 @@ fn to_requires_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3585,7 +3585,7 @@ fn to_packages_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ @@ -3623,7 +3623,7 @@ fn to_space_report<'a>( BadInputError::HasTab => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I encountered a tab character"), alloc.region(region), alloc.concat([alloc.reflow("Tab characters are not allowed.")]), @@ -3704,7 +3704,7 @@ fn to_unfinished_ability_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.reflow(r"I was partway through parsing an ability definition, but I got stuck here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), message, diff --git a/reporting/src/error/type.rs b/reporting/src/error/type.rs index e7e06ccd03..89c25f55c6 100644 --- a/reporting/src/error/type.rs +++ b/reporting/src/error/type.rs @@ -79,7 +79,7 @@ pub fn type_problem<'b>( let found_arguments = alloc.text(type_got.to_string()); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.concat([ alloc.reflow("The "), alloc.symbol_unqualified(symbol), @@ -125,7 +125,7 @@ pub fn type_problem<'b>( report(title, doc, filename) } BadExprMissingAbility(region, category, found, incomplete) => { - let note = alloc.stack(vec![ + let note = alloc.stack([ alloc.reflow("The ways this expression is used requires that the following types implement the following abilities, which they do not:"), alloc.type_block(alloc.stack(incomplete.iter().map(|incomplete| { symbol_does_not_implement(alloc, incomplete.typ, incomplete.ability) @@ -159,7 +159,7 @@ pub fn type_problem<'b>( Some(report) } BadPatternMissingAbility(region, category, found, incomplete) => { - let note = alloc.stack(vec![ + let note = alloc.stack([ alloc.reflow("The ways this expression is used requires that the following types implement the following abilities, which they do not:"), alloc.type_block(alloc.stack(incomplete.iter().map(|incomplete| { symbol_does_not_implement(alloc, incomplete.typ, incomplete.ability) @@ -255,7 +255,7 @@ fn report_shadowing<'b>( ) -> RocDocBuilder<'b> { let line = r#"Since these types have the same name, it's easy to use the wrong one on accident. Give one of them a new name."#; - alloc.stack(vec![ + alloc.stack([ alloc .text("The ") .append(alloc.ident(shadow.value)) @@ -278,7 +278,7 @@ pub fn cyclic_alias<'b>( alloc.reflow("Recursion in aliases is only allowed if recursion happens behind a tagged union, at least one variant of which is not recursive."); let doc = if others.is_empty() { - alloc.stack(vec![ + alloc.stack([ alloc .reflow("The ") .append(alloc.symbol_unqualified(symbol)) @@ -287,7 +287,7 @@ pub fn cyclic_alias<'b>( when_is_recursion_legal, ]) } else { - alloc.stack(vec![ + alloc.stack([ alloc .reflow("The ") .append(alloc.symbol_unqualified(symbol)) @@ -477,7 +477,7 @@ fn to_expr_report<'b>( Report { filename, title: "TYPE MISMATCH".to_string(), - doc: alloc.stack(vec![ + doc: alloc.stack([ alloc.text("This expression is used in an unexpected way:"), alloc.region(lines.convert_region(expr_region)), comparison, @@ -586,7 +586,7 @@ fn to_expr_report<'b>( Report { title: "TYPE MISMATCH".to_string(), filename, - doc: alloc.stack(vec![ + doc: alloc.stack([ alloc.text("Something is off with the ").append(thing), { // for typed bodies, include the line(s) with the signature @@ -1080,7 +1080,7 @@ fn to_expr_report<'b>( stack.push(does_not_implement(alloc, err_type, ability)); } - let hint = alloc.stack(vec![ + let hint = alloc.stack([ alloc.concat([ alloc.note(""), alloc.reflow("Some types in this specialization don't implement the abilities they are expected to. I found the following missing implementations:"), @@ -1123,7 +1123,7 @@ fn to_expr_report<'b>( alloc.reflow(" says it must match:"), ]); - let note = alloc.stack(vec![ + let note = alloc.stack([ alloc.concat([ alloc.note(""), alloc.reflow("The specialized type is too general, and does not provide a concrete type where a type variable is bound to an ability."), @@ -1527,7 +1527,7 @@ fn to_pattern_report<'b>( match expected { PExpected::NoExpectation(expected_type) => { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc.text("This pattern is being used in an unexpected way:"), alloc.region(lines.convert_region(expr_region)), pattern_type_comparison( @@ -1555,7 +1555,7 @@ fn to_pattern_report<'b>( Some(n) => alloc.symbol_unqualified(n), None => alloc.text(" this definition "), }; - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .text("The ") .append(alloc.text(index.ordinal())) @@ -1592,7 +1592,7 @@ fn to_pattern_report<'b>( } PReason::WhenMatch { index } => { if index == HumanIndex::FIRST { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .text("The 1st pattern in this ") .append(alloc.keyword("when")) @@ -1625,7 +1625,7 @@ fn to_pattern_report<'b>( severity: Severity::RuntimeError, } } else { - let doc = alloc.stack(vec![ + let doc = alloc.stack([ alloc .string(format!("The {} pattern in this ", index.ordinal())) .append(alloc.keyword("when")) @@ -1735,13 +1735,13 @@ fn to_circular_report<'b>( title: "CIRCULAR TYPE".to_string(), filename, doc: { - alloc.stack(vec![ + alloc.stack([ alloc .reflow("I'm inferring a weird self-referential type for ") .append(alloc.symbol_unqualified(symbol)) .append(alloc.text(":")), alloc.region(lines.convert_region(region)), - alloc.stack(vec![ + alloc.stack([ alloc.reflow( "Here is my best effort at writing down the type. \ You will see ∞ for parts of the type that repeat \ @@ -3226,7 +3226,7 @@ fn type_problem_to_pretty<'b>( Can you use an open tag union?", )); - alloc.stack(vec![tip1, tip2]) + alloc.stack([tip1, tip2]) } Some((last, init)) => { @@ -3249,7 +3249,7 @@ fn type_problem_to_pretty<'b>( Can you use an open tag union?", )); - alloc.stack(vec![tip1, tip2]) + alloc.stack([tip1, tip2]) } }, (OptionalRequiredMismatch(field), _) => alloc.tip().append(alloc.concat([ @@ -3309,7 +3309,7 @@ fn report_record_field_typo<'b>( actual_fields.into_iter().collect::>(), ); - let doc = alloc.stack(vec![ + let doc = alloc.stack([ header, alloc.region(lines.convert_region(field_region)), if suggestions.is_empty() { @@ -3330,7 +3330,7 @@ fn report_record_field_typo<'b>( None => alloc.text("fields on the record"), }; - alloc.stack(vec![ + alloc.stack([ alloc.concat([ alloc.reflow("There may be a typo. These "), r_doc, diff --git a/reporting/src/report.rs b/reporting/src/report.rs index 29cfe43c09..a97537e18c 100644 --- a/reporting/src/report.rs +++ b/reporting/src/report.rs @@ -135,10 +135,7 @@ impl<'b> Report<'b> { "─".repeat(80 - (self.title.len() + 4)) ); - alloc.stack(vec![ - alloc.text(header).annotate(Annotation::Header), - self.doc, - ]) + alloc.stack([alloc.text(header).annotate(Annotation::Header), self.doc]) } }