Skip to content

Commit bf0509e

Browse files
authored
[misc] Fix typo in error messages (#1184)
1 parent 63268d4 commit bf0509e

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

crates/samlang-checker/src/checker_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,7 +3020,7 @@ Found 3 errors.
30203020
r#"
30213021
Error ---------------------------------- DUMMY.sam:1:25-1:64
30223022
3023-
This pattern-matching is not exhausive.
3023+
This pattern-matching is not exhaustive.
30243024
Here is an example of a non-matching value: `Bar(_)`.
30253025
30263026
1| { let _ = (t: Test2) -> match (t) { Foo(_) -> 1, Baz(s) -> 2, }; }
@@ -3267,7 +3267,7 @@ Found 1 error.
32673267
r#"
32683268
Error ----------------------------------- DUMMY.sam:1:6-1:12
32693269
3270-
This pattern-matching is not exhausive.
3270+
This pattern-matching is not exhaustive.
32713271
Here is an example of a non-matching value: `Bar(_)`.
32723272
32733273
1| {let Foo(_) = Test2.Foo(false);}

crates/samlang-checker/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod checker_tests;
1111
mod global_signature;
1212
/// The main checker that connects everything together.
1313
mod main_checker;
14-
/// The module that verify the usefulness and exhausiveness of patterns.
14+
/// The module that verify the usefulness and exhaustiveness of patterns.
1515
mod pattern_matching;
1616
/// Computing the SSA graph.
1717
mod ssa_analysis;

crates/samlang-checker/src/main_checker.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ fn check_match(
992992
if let Some(description) =
993993
pattern_matching::incomplete_counterexample(cx, &abstract_pattern_nodes)
994994
{
995-
cx.error_set.report_non_exhausive_match_error(expression.common.loc, description);
995+
cx.error_set.report_non_exhaustive_match_error(expression.common.loc, description);
996996
}
997997
expr::E::Match(expr::Match {
998998
common: expression.common.with_new_type(Rc::new(
@@ -1224,7 +1224,7 @@ fn check_matching_pattern(
12241224
abstract_pattern_nodes.push(abstract_node);
12251225
}
12261226
if fields.len() > checked_destructured_names.len() {
1227-
cx.error_set.report_non_exhausive_tuple_binding_error(
1227+
cx.error_set.report_non_exhaustive_tuple_binding_error(
12281228
*pattern_loc,
12291229
fields.len(),
12301230
checked_destructured_names.len(),
@@ -1318,7 +1318,7 @@ fn check_matching_pattern(
13181318
abstract_pattern_nodes[*field_order] = abstract_node;
13191319
}
13201320
if !not_mentioned_fields.is_empty() {
1321-
cx.error_set.report_non_exhausive_struct_binding_error(
1321+
cx.error_set.report_non_exhaustive_struct_binding_error(
13221322
*pattern_loc,
13231323
not_mentioned_fields.into_iter().collect(),
13241324
);
@@ -1418,7 +1418,7 @@ fn check_matching_pattern(
14181418
(0, None)
14191419
};
14201420
if resolved_enum_variant.types.len() > checked_data_variables_len {
1421-
cx.error_set.report_non_exhausive_tuple_binding_error(
1421+
cx.error_set.report_non_exhaustive_tuple_binding_error(
14221422
*loc,
14231423
resolved_enum_variant.types.len(),
14241424
checked_data_variables_len,
@@ -1487,7 +1487,7 @@ fn check_statement(
14871487
if let Some(description) =
14881488
pattern_matching::incomplete_counterexample(cx, &[abstract_pattern_node])
14891489
{
1490-
cx.error_set.report_non_exhausive_match_error(*checked_pattern.loc(), description);
1490+
cx.error_set.report_non_exhaustive_match_error(*checked_pattern.loc(), description);
14911491
}
14921492
expr::DeclarationStatement {
14931493
loc: *loc,

crates/samlang-errors/src/lib.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,9 @@ pub enum ErrorDetail {
586586
MissingClassMemberDefinitions { missing_definitions: Vec<PStr> },
587587
MissingExport { module_reference: ModuleReference, name: PStr },
588588
NameAlreadyBound { name: PStr, old_loc: Location },
589-
NonExhausiveStructBinding { missing_bindings: Vec<PStr> },
590-
NonExhausiveTupleBinding { expected_count: usize, actual_count: usize },
591-
NonExhausiveMatch { counter_example: Description },
589+
NonExhaustiveStructBinding { missing_bindings: Vec<PStr> },
590+
NonExhaustiveTupleBinding { expected_count: usize, actual_count: usize },
591+
NonExhaustiveMatch { counter_example: Description },
592592
NotAnEnum { description: Description },
593593
NotAStruct { description: Description },
594594
Stacked(StackableError),
@@ -678,7 +678,7 @@ impl ErrorDetail {
678678
printable_stream.push_location(old_loc);
679679
printable_stream.push_text(".");
680680
}
681-
ErrorDetail::NonExhausiveStructBinding { missing_bindings } => {
681+
ErrorDetail::NonExhaustiveStructBinding { missing_bindings } => {
682682
printable_stream.push_text(
683683
"The pattern does not bind all fields. The following names have not been mentioned:",
684684
);
@@ -688,17 +688,17 @@ impl ErrorDetail {
688688
printable_stream.push_text("`");
689689
}
690690
}
691-
ErrorDetail::NonExhausiveTupleBinding { expected_count, actual_count } => {
691+
ErrorDetail::NonExhaustiveTupleBinding { expected_count, actual_count } => {
692692
printable_stream
693693
.push_text("The pattern does not bind all fields. Expected number of elements: ");
694694
printable_stream.push_size(*expected_count);
695695
printable_stream.push_text(", actual number of elements: ");
696696
printable_stream.push_size(*actual_count);
697697
printable_stream.push_text(".");
698698
}
699-
ErrorDetail::NonExhausiveMatch { counter_example } => {
699+
ErrorDetail::NonExhaustiveMatch { counter_example } => {
700700
printable_stream.push_text(
701-
"This pattern-matching is not exhausive.\nHere is an example of a non-matching value: `",
701+
"This pattern-matching is not exhaustive.\nHere is an example of a non-matching value: `",
702702
);
703703
printable_stream.push_description(counter_example);
704704
printable_stream.push_text("`.");
@@ -1014,25 +1014,25 @@ impl ErrorSet {
10141014
self.report_error(new_loc, ErrorDetail::NameAlreadyBound { name, old_loc })
10151015
}
10161016

1017-
pub fn report_non_exhausive_struct_binding_error(
1017+
pub fn report_non_exhaustive_struct_binding_error(
10181018
&mut self,
10191019
loc: Location,
10201020
missing_bindings: Vec<PStr>,
10211021
) {
1022-
self.report_error(loc, ErrorDetail::NonExhausiveStructBinding { missing_bindings })
1022+
self.report_error(loc, ErrorDetail::NonExhaustiveStructBinding { missing_bindings })
10231023
}
10241024

1025-
pub fn report_non_exhausive_tuple_binding_error(
1025+
pub fn report_non_exhaustive_tuple_binding_error(
10261026
&mut self,
10271027
loc: Location,
10281028
expected_count: usize,
10291029
actual_count: usize,
10301030
) {
1031-
self.report_error(loc, ErrorDetail::NonExhausiveTupleBinding { expected_count, actual_count })
1031+
self.report_error(loc, ErrorDetail::NonExhaustiveTupleBinding { expected_count, actual_count })
10321032
}
10331033

1034-
pub fn report_non_exhausive_match_error(&mut self, loc: Location, counter_example: Description) {
1035-
self.report_error(loc, ErrorDetail::NonExhausiveMatch { counter_example })
1034+
pub fn report_non_exhaustive_match_error(&mut self, loc: Location, counter_example: Description) {
1035+
self.report_error(loc, ErrorDetail::NonExhaustiveMatch { counter_example })
10361036
}
10371037

10381038
pub fn report_not_an_enum_error(&mut self, loc: Location, description: Description) {
@@ -1207,12 +1207,12 @@ Found 2 errors."#
12071207
heap.alloc_str_for_test("bar"),
12081208
);
12091209
error_set.report_name_already_bound_error(Location::dummy(), PStr::LOWER_A, Location::dummy());
1210-
error_set.report_non_exhausive_struct_binding_error(
1210+
error_set.report_non_exhaustive_struct_binding_error(
12111211
Location::dummy(),
12121212
vec![PStr::UPPER_A, PStr::UPPER_B],
12131213
);
1214-
error_set.report_non_exhausive_tuple_binding_error(Location::dummy(), 7, 4);
1215-
error_set.report_non_exhausive_match_error(Location::dummy(), Description::IntType);
1214+
error_set.report_non_exhaustive_tuple_binding_error(Location::dummy(), 7, 4);
1215+
error_set.report_non_exhaustive_match_error(Location::dummy(), Description::IntType);
12161216
error_set.report_not_an_enum_error(Location::dummy(), Description::IntType);
12171217
error_set.report_not_a_struct_error(Location::dummy(), Description::IntType);
12181218
error_set.report_stackable_error(Location::dummy(), {
@@ -1321,7 +1321,7 @@ The pattern does not bind all fields. Expected number of elements: 7, actual num
13211321
13221322
Error ------------------------------------ DUMMY.sam:0:0-0:0
13231323
1324-
This pattern-matching is not exhausive.
1324+
This pattern-matching is not exhaustive.
13251325
Here is an example of a non-matching value: `int`.
13261326
13271327
14 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)