chore: rename assignment kind
This commit is contained in:
parent
dbd162e985
commit
3f540c7c99
|
@ -766,7 +766,7 @@ impl<A, B> Pattern<A, B> {
|
|||
#[derive(Debug, Clone, PartialEq, Eq, Copy)]
|
||||
pub enum AssignmentKind {
|
||||
Let,
|
||||
Assert,
|
||||
Expect,
|
||||
}
|
||||
|
||||
impl AssignmentKind {
|
||||
|
@ -775,7 +775,7 @@ impl AssignmentKind {
|
|||
}
|
||||
|
||||
pub fn is_assert(&self) -> bool {
|
||||
matches!(self, AssignmentKind::Assert)
|
||||
matches!(self, AssignmentKind::Expect)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ impl<'comments> Formatter<'comments> {
|
|||
|
||||
let keyword = match kind {
|
||||
Some(AssignmentKind::Let) => "let ",
|
||||
Some(AssignmentKind::Assert) => "assert ",
|
||||
Some(AssignmentKind::Expect) => "assert ",
|
||||
None => "try ",
|
||||
};
|
||||
|
||||
|
|
|
@ -1038,7 +1038,7 @@ pub fn expr_parser(
|
|||
location: span,
|
||||
value: Box::new(value),
|
||||
pattern,
|
||||
kind: ast::AssignmentKind::Assert,
|
||||
kind: ast::AssignmentKind::Expect,
|
||||
annotation,
|
||||
},
|
||||
);
|
||||
|
|
|
@ -369,7 +369,7 @@ fn expect() {
|
|||
with_spread: false,
|
||||
tipo: (),
|
||||
},
|
||||
kind: ast::AssignmentKind::Assert,
|
||||
kind: ast::AssignmentKind::Expect,
|
||||
annotation: None,
|
||||
},
|
||||
expr::UntypedExpr::FieldAccess {
|
||||
|
|
|
@ -333,7 +333,7 @@ Perhaps, try the following:
|
|||
#[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):
|
||||
|
||||
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 },
|
||||
|
||||
#[error("I discovered a function which is ending with an assignment.\n")]
|
||||
|
|
|
@ -877,7 +877,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
|
|||
// We currently only do limited exhaustiveness checking of custom types
|
||||
// at the top level of patterns.
|
||||
// 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(
|
||||
vec![pattern.clone()],
|
||||
collapse_links(value_typ.clone()),
|
||||
|
|
|
@ -1578,7 +1578,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
|
||||
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()
|
||||
&& !tipo.is_data()
|
||||
{
|
||||
|
@ -1604,7 +1604,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
pattern_vec.append(value_vec);
|
||||
}
|
||||
list @ Pattern::List { .. } => {
|
||||
if matches!(assignment_properties.kind, AssignmentKind::Assert)
|
||||
if matches!(assignment_properties.kind, AssignmentKind::Expect)
|
||||
&& assignment_properties.value_type.is_data()
|
||||
&& !tipo.is_data()
|
||||
{
|
||||
|
@ -1629,7 +1629,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
}
|
||||
// TODO: Check constr for assert on all cases
|
||||
constr @ Pattern::Constructor { .. } => {
|
||||
if matches!(assignment_properties.kind, AssignmentKind::Assert)
|
||||
if matches!(assignment_properties.kind, AssignmentKind::Expect)
|
||||
&& assignment_properties.value_type.is_data()
|
||||
&& !tipo.is_data()
|
||||
{
|
||||
|
@ -1653,7 +1653,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
}
|
||||
}
|
||||
tuple @ Pattern::Tuple { .. } => {
|
||||
if matches!(assignment_properties.kind, AssignmentKind::Assert)
|
||||
if matches!(assignment_properties.kind, AssignmentKind::Expect)
|
||||
&& assignment_properties.value_type.is_data()
|
||||
&& !tipo.is_data()
|
||||
{
|
||||
|
@ -2503,7 +2503,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
let id = self.id_gen.next();
|
||||
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()
|
||||
&& !tipo.is_data()
|
||||
{
|
||||
|
@ -2556,7 +2556,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
let id = self.id_gen.next();
|
||||
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()
|
||||
&& !tipo.is_data()
|
||||
{
|
||||
|
@ -2605,7 +2605,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
let id = self.id_gen.next();
|
||||
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()
|
||||
&& !tipo.is_data()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue