chore: rename assignment kind

This commit is contained in:
rvcas 2023-02-09 00:47:38 -05:00
parent dbd162e985
commit 3f540c7c99
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
7 changed files with 14 additions and 14 deletions

View File

@ -766,7 +766,7 @@ impl<A, B> Pattern<A, B> {
#[derive(Debug, Clone, PartialEq, Eq, Copy)] #[derive(Debug, Clone, PartialEq, Eq, Copy)]
pub enum AssignmentKind { pub enum AssignmentKind {
Let, Let,
Assert, Expect,
} }
impl AssignmentKind { impl AssignmentKind {
@ -775,7 +775,7 @@ impl AssignmentKind {
} }
pub fn is_assert(&self) -> bool { pub fn is_assert(&self) -> bool {
matches!(self, AssignmentKind::Assert) matches!(self, AssignmentKind::Expect)
} }
} }

View File

@ -606,7 +606,7 @@ impl<'comments> Formatter<'comments> {
let keyword = match kind { let keyword = match kind {
Some(AssignmentKind::Let) => "let ", Some(AssignmentKind::Let) => "let ",
Some(AssignmentKind::Assert) => "assert ", Some(AssignmentKind::Expect) => "assert ",
None => "try ", None => "try ",
}; };

View File

@ -1038,7 +1038,7 @@ pub fn expr_parser(
location: span, location: span,
value: Box::new(value), value: Box::new(value),
pattern, pattern,
kind: ast::AssignmentKind::Assert, kind: ast::AssignmentKind::Expect,
annotation, annotation,
}, },
); );

View File

@ -369,7 +369,7 @@ fn expect() {
with_spread: false, with_spread: false,
tipo: (), tipo: (),
}, },
kind: ast::AssignmentKind::Assert, kind: ast::AssignmentKind::Expect,
annotation: None, annotation: None,
}, },
expr::UntypedExpr::FieldAccess { expr::UntypedExpr::FieldAccess {

View File

@ -333,7 +333,7 @@ Perhaps, try the following:
#[diagnostic(code("illegal::module_name"))] #[diagnostic(code("illegal::module_name"))]
#[diagnostic(help(r#"You cannot use keywords as part of a module path name. As a quick reminder, here's a list of all the keywords (and thus, of invalid module path names): #[diagnostic(help(r#"You cannot use keywords as part of a module path name. As a quick reminder, here's a list of all the keywords (and thus, of invalid module path names):
as, assert, check, const, else, fn, if, is, let, opaque, pub, test, todo, trace, type, use, when"#))] as, expect, check, const, else, fn, if, is, let, opaque, pub, test, todo, trace, type, use, when"#))]
KeywordInModuleName { name: String, keyword: String }, KeywordInModuleName { name: String, keyword: String },
#[error("I discovered a function which is ending with an assignment.\n")] #[error("I discovered a function which is ending with an assignment.\n")]

View File

@ -877,7 +877,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
// We currently only do limited exhaustiveness checking of custom types // We currently only do limited exhaustiveness checking of custom types
// at the top level of patterns. // at the top level of patterns.
// Do not perform exhaustiveness checking if user explicitly used `assert`. // Do not perform exhaustiveness checking if user explicitly used `assert`.
if kind != AssignmentKind::Assert { if kind != AssignmentKind::Expect {
if let Err(unmatched) = self.environment.check_exhaustiveness( if let Err(unmatched) = self.environment.check_exhaustiveness(
vec![pattern.clone()], vec![pattern.clone()],
collapse_links(value_typ.clone()), collapse_links(value_typ.clone()),

View File

@ -1578,7 +1578,7 @@ impl<'a> CodeGenerator<'a> {
pattern_vec.append(value_vec); pattern_vec.append(value_vec);
if matches!(assignment_properties.kind, AssignmentKind::Assert) if matches!(assignment_properties.kind, AssignmentKind::Expect)
&& assignment_properties.value_type.is_data() && assignment_properties.value_type.is_data()
&& !tipo.is_data() && !tipo.is_data()
{ {
@ -1604,7 +1604,7 @@ impl<'a> CodeGenerator<'a> {
pattern_vec.append(value_vec); pattern_vec.append(value_vec);
} }
list @ Pattern::List { .. } => { list @ Pattern::List { .. } => {
if matches!(assignment_properties.kind, AssignmentKind::Assert) if matches!(assignment_properties.kind, AssignmentKind::Expect)
&& assignment_properties.value_type.is_data() && assignment_properties.value_type.is_data()
&& !tipo.is_data() && !tipo.is_data()
{ {
@ -1629,7 +1629,7 @@ impl<'a> CodeGenerator<'a> {
} }
// TODO: Check constr for assert on all cases // TODO: Check constr for assert on all cases
constr @ Pattern::Constructor { .. } => { constr @ Pattern::Constructor { .. } => {
if matches!(assignment_properties.kind, AssignmentKind::Assert) if matches!(assignment_properties.kind, AssignmentKind::Expect)
&& assignment_properties.value_type.is_data() && assignment_properties.value_type.is_data()
&& !tipo.is_data() && !tipo.is_data()
{ {
@ -1653,7 +1653,7 @@ impl<'a> CodeGenerator<'a> {
} }
} }
tuple @ Pattern::Tuple { .. } => { tuple @ Pattern::Tuple { .. } => {
if matches!(assignment_properties.kind, AssignmentKind::Assert) if matches!(assignment_properties.kind, AssignmentKind::Expect)
&& assignment_properties.value_type.is_data() && assignment_properties.value_type.is_data()
&& !tipo.is_data() && !tipo.is_data()
{ {
@ -2503,7 +2503,7 @@ impl<'a> CodeGenerator<'a> {
let id = self.id_gen.next(); let id = self.id_gen.next();
let list_name = format!("__list_{id}"); let list_name = format!("__list_{id}");
if matches!(assignment_properties.kind, AssignmentKind::Assert) if matches!(assignment_properties.kind, AssignmentKind::Expect)
&& assignment_properties.value_type.is_data() && assignment_properties.value_type.is_data()
&& !tipo.is_data() && !tipo.is_data()
{ {
@ -2556,7 +2556,7 @@ impl<'a> CodeGenerator<'a> {
let id = self.id_gen.next(); let id = self.id_gen.next();
let constr_name = format!("{constr_name}_{id}"); let constr_name = format!("{constr_name}_{id}");
if matches!(assignment_properties.kind, AssignmentKind::Assert) if matches!(assignment_properties.kind, AssignmentKind::Expect)
&& assignment_properties.value_type.is_data() && assignment_properties.value_type.is_data()
&& !tipo.is_data() && !tipo.is_data()
{ {
@ -2605,7 +2605,7 @@ impl<'a> CodeGenerator<'a> {
let id = self.id_gen.next(); let id = self.id_gen.next();
let tuple_name = format!("__tuple_name_{id}"); let tuple_name = format!("__tuple_name_{id}");
if matches!(assignment_properties.kind, AssignmentKind::Assert) if matches!(assignment_properties.kind, AssignmentKind::Expect)
&& assignment_properties.value_type.is_data() && assignment_properties.value_type.is_data()
&& !tipo.is_data() && !tipo.is_data()
{ {