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