tamer: asg::air: Remove `Air::` token variant prefixes from tests

This just removes noise from test, as has become standard in various other
tests in TAMER.

DEV-13163
main
Mike Gerwitz 2023-07-11 10:03:15 -04:00
parent 24ee041373
commit 2e33e9e93e
2 changed files with 245 additions and 244 deletions

View File

@ -24,7 +24,8 @@ use crate::asg::{
air_ctx_from_pkg_body_toks, air_ctx_from_toks, parse_as_pkg_body, air_ctx_from_pkg_body_toks, air_ctx_from_toks, parse_as_pkg_body,
pkg_expect_ident_obj, pkg_expect_ident_oi, pkg_lookup, pkg_expect_ident_obj, pkg_expect_ident_oi, pkg_lookup,
}, },
Air, AirAggregate, Air::*,
AirAggregate,
}, },
graph::object::{expr::ExprRel, Doc, ObjectRel}, graph::object::{expr::ExprRel, Doc, ObjectRel},
ExprOp, Ident, ExprOp, Ident,
@ -50,9 +51,9 @@ fn expr_empty_ident() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
Air::BindIdent(id), BindIdent(id),
Air::ExprEnd(S3), ExprEnd(S3),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -68,10 +69,10 @@ fn expr_without_pkg() {
let toks = vec![ let toks = vec![
// No package // No package
// (because we're not parsing with `parse_as_pkg_body` below) // (because we're not parsing with `parse_as_pkg_body` below)
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
// RECOVERY // RECOVERY
Air::PkgStart(S2, SPair("/pkg".into(), S2)), PkgStart(S2, SPair("/pkg".into(), S2)),
Air::PkgEnd(S3), PkgEnd(S3),
]; ];
assert_eq!( assert_eq!(
@ -92,14 +93,14 @@ fn close_pkg_mid_expr() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::PkgStart(S1, SPair("/pkg".into(), S1)), PkgStart(S1, SPair("/pkg".into(), S1)),
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
Air::PkgEnd(S3), PkgEnd(S3),
// RECOVERY: Let's finish the expression first... // RECOVERY: Let's finish the expression first...
Air::BindIdent(id), BindIdent(id),
Air::ExprEnd(S5), ExprEnd(S5),
// ...and then try to close again. // ...and then try to close again.
Air::PkgEnd(S6), PkgEnd(S6),
]; ];
assert_eq!( assert_eq!(
@ -129,14 +130,14 @@ fn open_pkg_mid_expr() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::PkgStart(S1, pkg_a), PkgStart(S1, pkg_a),
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
Air::PkgStart(S3, pkg_nested), PkgStart(S3, pkg_nested),
// RECOVERY: We should still be able to complete successfully. // RECOVERY: We should still be able to complete successfully.
Air::BindIdent(id), BindIdent(id),
Air::ExprEnd(S5), ExprEnd(S5),
// Closes the _original_ package. // Closes the _original_ package.
Air::PkgEnd(S6), PkgEnd(S6),
]; ];
assert_eq!( assert_eq!(
@ -168,18 +169,18 @@ fn expr_non_empty_ident_root() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
// Identifier while still empty... // Identifier while still empty...
Air::BindIdent(id_a), BindIdent(id_a),
Air::ExprStart(ExprOp::Sum, S3), ExprStart(ExprOp::Sum, S3),
// (note that the inner expression _does not_ have an ident // (note that the inner expression _does not_ have an ident
// binding) // binding)
Air::ExprEnd(S4), ExprEnd(S4),
// ...and an identifier non-empty. // ...and an identifier non-empty.
Air::BindIdent(id_b), BindIdent(id_b),
Air::ExprEnd(S6), ExprEnd(S6),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -201,16 +202,16 @@ fn expr_non_empty_bind_only_after() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
// Expression root is still dangling at this point. // Expression root is still dangling at this point.
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
Air::ExprEnd(S3), ExprEnd(S3),
// We only bind an identifier _after_ we've created the expression, // We only bind an identifier _after_ we've created the expression,
// which should cause the still-dangling root to become // which should cause the still-dangling root to become
// reachable. // reachable.
Air::BindIdent(id), BindIdent(id),
Air::ExprEnd(S5), ExprEnd(S5),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -226,10 +227,10 @@ fn expr_non_empty_bind_only_after() {
#[test] #[test]
fn expr_dangling_no_subexpr() { fn expr_dangling_no_subexpr() {
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
// No `BindIdent`, // No `BindIdent`,
// so this expression is dangling. // so this expression is dangling.
Air::ExprEnd(S2), ExprEnd(S2),
]; ];
// The error span should encompass the entire expression. // The error span should encompass the entire expression.
@ -252,13 +253,13 @@ fn expr_dangling_no_subexpr() {
fn expr_dangling_with_subexpr() { fn expr_dangling_with_subexpr() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
// Expression root is still dangling at this point. // Expression root is still dangling at this point.
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
Air::ExprEnd(S3), ExprEnd(S3),
// Still no ident binding, // Still no ident binding,
// so root should still be dangling. // so root should still be dangling.
Air::ExprEnd(S4), ExprEnd(S4),
]; ];
let full_span = S1.merge(S4).unwrap(); let full_span = S1.merge(S4).unwrap();
@ -284,19 +285,19 @@ fn expr_dangling_with_subexpr_ident() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
// Expression root is still dangling at this point. // Expression root is still dangling at this point.
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
// The _inner_ expression receives an identifier, // The _inner_ expression receives an identifier,
// but that should have no impact on the dangling status of // but that should have no impact on the dangling status of
// the root, // the root,
// especially given that subexpressions are always reachable // especially given that subexpressions are always reachable
// anyway. // anyway.
Air::BindIdent(id), BindIdent(id),
Air::ExprEnd(S4), ExprEnd(S4),
// But the root still has no ident binding, // But the root still has no ident binding,
// and so should still be dangling. // and so should still be dangling.
Air::ExprEnd(S5), ExprEnd(S5),
]; ];
let full_span = S1.merge(S5).unwrap(); let full_span = S1.merge(S5).unwrap();
@ -328,13 +329,13 @@ fn expr_reachable_subsequent_dangling() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
// Reachable // Reachable
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
Air::BindIdent(id), BindIdent(id),
Air::ExprEnd(S3), ExprEnd(S3),
// Dangling // Dangling
Air::ExprStart(ExprOp::Sum, S4), ExprStart(ExprOp::Sum, S4),
Air::ExprEnd(S5), ExprEnd(S5),
]; ];
// The error span should encompass the entire expression. // The error span should encompass the entire expression.
@ -367,13 +368,13 @@ fn recovery_expr_reachable_after_dangling() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
// Dangling // Dangling
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
Air::ExprEnd(S2), ExprEnd(S2),
// Reachable, after error from dangling. // Reachable, after error from dangling.
Air::ExprStart(ExprOp::Sum, S3), ExprStart(ExprOp::Sum, S3),
Air::BindIdent(id), BindIdent(id),
Air::ExprEnd(S5), ExprEnd(S5),
]; ];
// The error span should encompass the entire expression. // The error span should encompass the entire expression.
@ -420,16 +421,16 @@ fn expr_close_unbalanced() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
// Close before _any_ open. // Close before _any_ open.
Air::ExprEnd(S1), ExprEnd(S1),
// Should recover, // Should recover,
// allowing for a normal expr. // allowing for a normal expr.
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
Air::BindIdent(id), BindIdent(id),
Air::ExprEnd(S4), ExprEnd(S4),
// And now an extra close _after_ a valid expr. // And now an extra close _after_ a valid expr.
Air::ExprEnd(S5), ExprEnd(S5),
]; ];
let mut sut = parse_as_pkg_body(toks); let mut sut = parse_as_pkg_body(toks);
@ -471,22 +472,22 @@ fn sibling_subexprs_have_ordered_edges_to_parent() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
// Identify the root so that it is not dangling. // Identify the root so that it is not dangling.
Air::BindIdent(id_root), BindIdent(id_root),
// Sibling A // Sibling A
Air::ExprStart(ExprOp::Sum, S3), ExprStart(ExprOp::Sum, S3),
Air::ExprEnd(S4), ExprEnd(S4),
// Sibling B // Sibling B
Air::ExprStart(ExprOp::Sum, S5), ExprStart(ExprOp::Sum, S5),
Air::ExprEnd(S6), ExprEnd(S6),
// Sibling C // Sibling C
Air::ExprStart(ExprOp::Sum, S7), ExprStart(ExprOp::Sum, S7),
Air::ExprEnd(S8), ExprEnd(S8),
Air::ExprEnd(S9), ExprEnd(S9),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -521,16 +522,16 @@ fn nested_subexprs_related_to_relative_parent() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), // 0 ExprStart(ExprOp::Sum, S1), // 0
Air::BindIdent(id_root), BindIdent(id_root),
Air::ExprStart(ExprOp::Sum, S2), // 1 ExprStart(ExprOp::Sum, S2), // 1
Air::BindIdent(id_suba), BindIdent(id_suba),
Air::ExprStart(ExprOp::Sum, S3), // 2 ExprStart(ExprOp::Sum, S3), // 2
Air::ExprEnd(S4), ExprEnd(S4),
Air::ExprEnd(S5), ExprEnd(S5),
Air::ExprEnd(S6), ExprEnd(S6),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -561,13 +562,13 @@ fn expr_redefine_ident() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
Air::BindIdent(id_first), BindIdent(id_first),
Air::ExprStart(ExprOp::Sum, S3), ExprStart(ExprOp::Sum, S3),
Air::BindIdent(id_dup), BindIdent(id_dup),
Air::ExprEnd(S4), ExprEnd(S4),
Air::ExprEnd(S5), ExprEnd(S5),
]; ];
let mut sut = parse_as_pkg_body(toks); let mut sut = parse_as_pkg_body(toks);
@ -614,24 +615,24 @@ fn expr_still_dangling_on_redefine() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
// First expr (OK) // First expr (OK)
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
Air::BindIdent(id_first), BindIdent(id_first),
Air::ExprEnd(S3), ExprEnd(S3),
// Second expr should still dangle due to use of duplicate // Second expr should still dangle due to use of duplicate
// identifier // identifier
Air::ExprStart(ExprOp::Sum, S4), ExprStart(ExprOp::Sum, S4),
Air::BindIdent(id_dup), BindIdent(id_dup),
Air::ExprEnd(S6), ExprEnd(S6),
// Third expr will error on redefine but then be successful. // Third expr will error on redefine but then be successful.
// This probably won't happen in practice with TAME's original // This probably won't happen in practice with TAME's original
// source language, // source language,
// but could happen at e.g. a REPL. // but could happen at e.g. a REPL.
Air::ExprStart(ExprOp::Sum, S7), ExprStart(ExprOp::Sum, S7),
Air::BindIdent(id_dup2), // fail BindIdent(id_dup2), // fail
Air::BindIdent(id_second), // succeed BindIdent(id_second), // succeed
Air::ExprEnd(S10), ExprEnd(S10),
]; ];
let mut sut = parse_as_pkg_body(toks); let mut sut = parse_as_pkg_body(toks);
@ -696,22 +697,22 @@ fn expr_ref_to_ident() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
Air::BindIdent(id_foo), BindIdent(id_foo),
// Reference to an as-of-yet-undefined id (okay), // Reference to an as-of-yet-undefined id (okay),
// with a different span than `id_bar`. // with a different span than `id_bar`.
Air::RefIdent(SPair("bar".into(), S3)), RefIdent(SPair("bar".into(), S3)),
Air::ExprEnd(S4), ExprEnd(S4),
// //
// Another expression to reference the first // Another expression to reference the first
// (we don't handle cyclic references until a topological sort, // (we don't handle cyclic references until a topological sort,
// so no point in referencing ourselves; // so no point in referencing ourselves;
// it'd work just fine here.) // it'd work just fine here.)
Air::ExprStart(ExprOp::Sum, S5), ExprStart(ExprOp::Sum, S5),
Air::BindIdent(id_bar), BindIdent(id_bar),
Air::ExprEnd(S7), ExprEnd(S7),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -755,16 +756,16 @@ fn idents_share_defining_pkg() {
// An expression nested within another. // An expression nested within another.
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::PkgStart(S1, SPair("/pkg".into(), S1)), PkgStart(S1, SPair("/pkg".into(), S1)),
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
Air::BindIdent(id_foo), BindIdent(id_foo),
Air::ExprStart(ExprOp::Sum, S4), ExprStart(ExprOp::Sum, S4),
Air::BindIdent(id_bar), BindIdent(id_bar),
Air::RefIdent(id_baz), RefIdent(id_baz),
Air::ExprEnd(S7), ExprEnd(S7),
Air::ExprEnd(S8), ExprEnd(S8),
Air::PkgEnd(S9), PkgEnd(S9),
]; ];
let ctx = air_ctx_from_toks(toks); let ctx = air_ctx_from_toks(toks);
@ -794,10 +795,10 @@ fn expr_doc_short_desc() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
Air::BindIdent(id_expr), BindIdent(id_expr),
Air::DocIndepClause(clause), DocIndepClause(clause),
Air::ExprEnd(S4), ExprEnd(S4),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -827,27 +828,27 @@ fn abstract_bind_without_dangling_container() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S1), ExprStart(ExprOp::Sum, S1),
// This expression is bound to an _abstract_ identifier, // This expression is bound to an _abstract_ identifier,
// which will be expanded at a later time. // which will be expanded at a later time.
// Consequently, // Consequently,
// this expression is still dangling. // this expression is still dangling.
Air::BindIdentAbstract(id_meta), BindIdentAbstract(id_meta),
// Since the expression is still dangling, // Since the expression is still dangling,
// attempting to close it will produce an error. // attempting to close it will produce an error.
Air::ExprEnd(S3), ExprEnd(S3),
// RECOVERY: Since an attempt at identification has been made, // RECOVERY: Since an attempt at identification has been made,
// we shouldn't expect that another attempt will be made. // we shouldn't expect that another attempt will be made.
// The sensible thing to do is to move on to try to find other // The sensible thing to do is to move on to try to find other
// errors, // errors,
// leaving the expression alone and unreachable. // leaving the expression alone and unreachable.
Air::ExprStart(ExprOp::Sum, S4), ExprStart(ExprOp::Sum, S4),
// This is intended to demonstrate that we can continue on to the // This is intended to demonstrate that we can continue on to the
// next expression despite the prior error. // next expression despite the prior error.
Air::BindIdent(id_ok), BindIdent(id_ok),
Air::ExprEnd(S6), ExprEnd(S6),
]; ];
let mut sut = parse_as_pkg_body(toks); let mut sut = parse_as_pkg_body(toks);

View File

@ -25,7 +25,7 @@ use crate::asg::{
air_ctx_from_pkg_body_toks, air_ctx_from_toks, parse_as_pkg_body, air_ctx_from_pkg_body_toks, air_ctx_from_toks, parse_as_pkg_body,
pkg_expect_ident_obj, pkg_expect_ident_oi, pkg_lookup, pkg_expect_ident_obj, pkg_expect_ident_oi, pkg_lookup,
}, },
Air, Air::*,
}, },
graph::object::{Doc, Meta, ObjectRel}, graph::object::{Doc, Meta, ObjectRel},
Expr, ExprOp, Ident, Expr, ExprOp, Ident,
@ -40,12 +40,12 @@ fn tpl_defining_pkg() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::PkgStart(S1, SPair("/pkg".into(), S1)), PkgStart(S1, SPair("/pkg".into(), S1)),
// This also tests tpl as a transition away from the package header. // This also tests tpl as a transition away from the package header.
Air::TplStart(S2), TplStart(S2),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
Air::TplEnd(S4), TplEnd(S4),
Air::PkgEnd(S5), PkgEnd(S5),
]; ];
let ctx = air_ctx_from_toks(toks); let ctx = air_ctx_from_toks(toks);
@ -68,18 +68,18 @@ fn tpl_after_expr() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::PkgStart(S1, SPair("/pkg".into(), S1)), PkgStart(S1, SPair("/pkg".into(), S1)),
// This expression is incidental to this test; // This expression is incidental to this test;
// it need only parse. // it need only parse.
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
Air::BindIdent(id_expr), BindIdent(id_expr),
Air::ExprEnd(S4), ExprEnd(S4),
// Open after an expression. // Open after an expression.
Air::TplStart(S5), TplStart(S5),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
Air::TplEnd(S7), TplEnd(S7),
Air::PkgEnd(S8), PkgEnd(S8),
]; ];
let ctx = air_ctx_from_toks(toks); let ctx = air_ctx_from_toks(toks);
@ -105,27 +105,27 @@ fn tpl_within_expr() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::PkgStart(S1, SPair("/pkg".into(), S1)), PkgStart(S1, SPair("/pkg".into(), S1)),
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
Air::BindIdent(id_expr), BindIdent(id_expr),
// Child expression before the template to ensure that the // Child expression before the template to ensure that the
// context is properly restored after template parsing. // context is properly restored after template parsing.
Air::ExprStart(ExprOp::Sum, S4), ExprStart(ExprOp::Sum, S4),
Air::ExprEnd(S5), ExprEnd(S5),
// Template _within_ an expression. // Template _within_ an expression.
// This will not be present in the final expression, // This will not be present in the final expression,
// as if it were hoisted out. // as if it were hoisted out.
Air::TplStart(S6), TplStart(S6),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
Air::TplEnd(S8), TplEnd(S8),
// Child expression _after_ the template for the same reason. // Child expression _after_ the template for the same reason.
Air::ExprStart(ExprOp::Sum, S9), ExprStart(ExprOp::Sum, S9),
Air::ExprEnd(S10), ExprEnd(S10),
Air::ExprEnd(S11), ExprEnd(S11),
Air::PkgEnd(S12), PkgEnd(S12),
]; ];
let ctx = air_ctx_from_toks(toks); let ctx = air_ctx_from_toks(toks);
@ -165,20 +165,20 @@ fn tpl_apply_within_expr() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::ExprStart(ExprOp::Sum, S2), ExprStart(ExprOp::Sum, S2),
Air::BindIdent(id_expr), BindIdent(id_expr),
// This will not be present in the final expression, // This will not be present in the final expression,
// as if it were hoisted out. // as if it were hoisted out.
Air::TplStart(S4), TplStart(S4),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
Air::TplEnd(S6), TplEnd(S6),
// But the application will remain. // But the application will remain.
Air::TplStart(S7), TplStart(S7),
Air::RefIdent(ref_tpl), RefIdent(ref_tpl),
Air::TplEndRef(S9), TplEndRef(S9),
Air::ExprEnd(S10), ExprEnd(S10),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -212,11 +212,11 @@ fn close_tpl_without_open() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplEnd(S1), TplEnd(S1),
// RECOVERY: Try again. // RECOVERY: Try again.
Air::TplStart(S2), TplStart(S2),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
Air::TplEnd(S4), TplEnd(S4),
]; ];
assert_eq!( assert_eq!(
@ -242,19 +242,19 @@ fn tpl_with_reachable_expression() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
Air::ExprStart(ExprOp::Sum, S3), ExprStart(ExprOp::Sum, S3),
// Must not be cached in the global env. // Must not be cached in the global env.
Air::BindIdent(id_expr_a), BindIdent(id_expr_a),
Air::ExprEnd(S5), ExprEnd(S5),
Air::ExprStart(ExprOp::Sum, S6), ExprStart(ExprOp::Sum, S6),
// Must not be cached in the global env. // Must not be cached in the global env.
Air::BindIdent(id_expr_b), BindIdent(id_expr_b),
Air::ExprEnd(S8), ExprEnd(S8),
Air::TplEnd(S9), TplEnd(S9),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -315,17 +315,17 @@ fn tpl_holds_dangling_expressions() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
// Dangling // Dangling
Air::ExprStart(ExprOp::Sum, S3), ExprStart(ExprOp::Sum, S3),
Air::ExprEnd(S4), ExprEnd(S4),
// Dangling // Dangling
Air::ExprStart(ExprOp::Sum, S5), ExprStart(ExprOp::Sum, S5),
Air::ExprEnd(S6), ExprEnd(S6),
Air::TplEnd(S7), TplEnd(S7),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -350,16 +350,16 @@ fn close_tpl_mid_open() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
Air::ExprStart(ExprOp::Sum, S3), ExprStart(ExprOp::Sum, S3),
Air::BindIdent(id_expr), BindIdent(id_expr),
// This is misplaced. // This is misplaced.
Air::TplEnd(S5), TplEnd(S5),
// RECOVERY: Close the expression and try again. // RECOVERY: Close the expression and try again.
Air::ExprEnd(S6), ExprEnd(S6),
Air::TplEnd(S7), TplEnd(S7),
]; ];
assert_eq!( assert_eq!(
@ -397,16 +397,16 @@ fn unreachable_anonymous_tpl() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
// No BindIdent // No BindIdent
Air::TplEnd(S2), TplEnd(S2),
// Recovery should ignore the above template // Recovery should ignore the above template
// (it's lost to the void) // (it's lost to the void)
// and allow continuing. // and allow continuing.
Air::TplStart(S3), TplStart(S3),
Air::BindIdent(id_ok), BindIdent(id_ok),
Air::TplEnd(S5), TplEnd(S5),
]; ];
let mut sut = parse_as_pkg_body(toks); let mut sut = parse_as_pkg_body(toks);
@ -441,12 +441,12 @@ fn unreachable_anonymous_tpl() {
fn anonymous_tpl_immediate_ref() { fn anonymous_tpl_immediate_ref() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
// No BindIdent // No BindIdent
// But ended with `TplEndRef`, // But ended with `TplEndRef`,
// so the missing identifier is okay. // so the missing identifier is okay.
// This would fail if it were `TplEnd`. // This would fail if it were `TplEnd`.
Air::TplEndRef(S2), TplEndRef(S2),
]; ];
let mut sut = parse_as_pkg_body(toks); let mut sut = parse_as_pkg_body(toks);
@ -466,21 +466,21 @@ fn tpl_with_param() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
// Metavariable with a value. // Metavariable with a value.
Air::MetaStart(S3), MetaStart(S3),
Air::BindIdent(id_param1), BindIdent(id_param1),
Air::MetaLexeme(pval1), MetaLexeme(pval1),
Air::MetaEnd(S6), MetaEnd(S6),
// Required metavariable (no value). // Required metavariable (no value).
Air::MetaStart(S7), MetaStart(S7),
Air::BindIdent(id_param2), BindIdent(id_param2),
Air::DocIndepClause(param_desc), DocIndepClause(param_desc),
Air::MetaEnd(S10), MetaEnd(S10),
Air::TplEnd(S11), TplEnd(S11),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -532,14 +532,14 @@ fn tpl_nested() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
Air::BindIdent(id_tpl_outer), BindIdent(id_tpl_outer),
// Inner template // Inner template
Air::TplStart(S3), TplStart(S3),
Air::BindIdent(id_tpl_inner), BindIdent(id_tpl_inner),
Air::TplEnd(S5), TplEnd(S5),
Air::TplEnd(S6), TplEnd(S6),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -577,13 +577,13 @@ fn tpl_apply_nested() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
Air::BindIdent(id_tpl_outer), BindIdent(id_tpl_outer),
// Inner template application // Inner template application
Air::TplStart(S3), TplStart(S3),
Air::TplEndRef(S4), TplEndRef(S4),
Air::TplEnd(S5), TplEnd(S5),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -615,25 +615,25 @@ fn tpl_apply_nested_missing() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
Air::BindIdent(id_tpl_outer), BindIdent(id_tpl_outer),
// Inner template application (Missing) // Inner template application (Missing)
Air::TplStart(S3), TplStart(S3),
Air::RefIdent(ref_tpl_inner_pre), RefIdent(ref_tpl_inner_pre),
Air::TplEndRef(S5), TplEndRef(S5),
// Define the template above // Define the template above
Air::TplStart(S6), TplStart(S6),
Air::BindIdent(id_tpl_inner), BindIdent(id_tpl_inner),
Air::TplEnd(S8), TplEnd(S8),
// Apply again, // Apply again,
// this time _after_ having been defined. // this time _after_ having been defined.
Air::TplStart(S9), TplStart(S9),
Air::RefIdent(ref_tpl_inner_post), RefIdent(ref_tpl_inner_post),
Air::TplEndRef(S11), TplEndRef(S11),
Air::TplEnd(S12), TplEnd(S12),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -683,10 +683,10 @@ fn tpl_doc_short_desc() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
Air::BindIdent(id_tpl), BindIdent(id_tpl),
Air::DocIndepClause(clause), DocIndepClause(clause),
Air::TplEnd(S4), TplEnd(S4),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -726,32 +726,32 @@ fn metavars_within_exprs_hoisted_to_parent_tpl() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
Air::BindIdent(id_tpl_outer), BindIdent(id_tpl_outer),
// This expression begins the body of the template. // This expression begins the body of the template.
// NIR would not allow params past this point. // NIR would not allow params past this point.
Air::ExprStart(ExprOp::Sum, S3), ExprStart(ExprOp::Sum, S3),
// Expresions are not containers and so this metavariable should // Expresions are not containers and so this metavariable should
// be hoisted to the parent container context. // be hoisted to the parent container context.
// That container must be a valid meta context. // That container must be a valid meta context.
Air::MetaStart(S4), MetaStart(S4),
Air::BindIdent(id_param_outer), BindIdent(id_param_outer),
Air::MetaEnd(S6), MetaEnd(S6),
Air::ExprEnd(S7), ExprEnd(S7),
// Nested template // Nested template
Air::TplStart(S8), TplStart(S8),
Air::BindIdent(id_tpl_inner), BindIdent(id_tpl_inner),
Air::ExprStart(ExprOp::Sum, S10), ExprStart(ExprOp::Sum, S10),
// Hoisting should be relative to the innermost template. // Hoisting should be relative to the innermost template.
Air::MetaStart(S11), MetaStart(S11),
Air::BindIdent(id_param_inner), BindIdent(id_param_inner),
Air::MetaEnd(S13), MetaEnd(S13),
Air::ExprEnd(S14), ExprEnd(S14),
Air::TplEnd(S15), TplEnd(S15),
Air::TplEnd(S16), TplEnd(S16),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);
@ -793,20 +793,20 @@ fn expr_abstract_bind_produces_cross_edge_from_ident_to_meta() {
#[rustfmt::skip] #[rustfmt::skip]
let toks = vec![ let toks = vec![
Air::TplStart(S1), TplStart(S1),
// This identifier is concrete; // This identifier is concrete;
// the abstract identifier will be the _expression_. // the abstract identifier will be the _expression_.
Air::BindIdent(id_tpl), BindIdent(id_tpl),
Air::ExprStart(ExprOp::Sum, S3), ExprStart(ExprOp::Sum, S3),
// This expression is bound to an _abstract_ identifier, // This expression is bound to an _abstract_ identifier,
// which will be expanded at a later time. // which will be expanded at a later time.
// This does _not_ change the dangling status, // This does _not_ change the dangling status,
// and so can only occur within an expression that acts as a // and so can only occur within an expression that acts as a
// container for otherwise-dangling expressions. // container for otherwise-dangling expressions.
Air::BindIdentAbstract(id_meta), BindIdentAbstract(id_meta),
Air::ExprEnd(S5), ExprEnd(S5),
Air::TplEnd(S6), TplEnd(S6),
]; ];
let ctx = air_ctx_from_pkg_body_toks(toks); let ctx = air_ctx_from_pkg_body_toks(toks);