Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Changes to the Rust Engine:
- Printers now emit proper diagnostics (PR #1669)
- Global identifiers are now interned (#1689)
- Global identifiers are encapsulated properly, and provide easy destructuring as tuple identifiers (#1693)
- Add basic support for traits and impls in the Lean backend (#1679)

Changes to the frontend:
- Add an explicit `Self: Trait` clause to trait methods and consts (#1559)
Expand Down
8 changes: 4 additions & 4 deletions examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-engine/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ pub mod traits {
);
derive_has_kind!(
Item => ItemKind, Expr => ExprKind, Pat => PatKind, Guard => GuardKind,
GenericParam => GenericParamKind, ImplItem => ImplItemKind, TraitItem => TraitItemKind
GenericParam => GenericParamKind, ImplItem => ImplItemKind, TraitItem => TraitItemKind, ImplExpr => ImplExprKind
);

impl HasSpan for Attribute {
Expand Down
24 changes: 24 additions & 0 deletions rust-engine/src/ast/identifiers/global_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,18 @@ impl GlobalId {
self.0.get().is_projector()
}

/// Returns true if the underlying identifier is a precondition (trait/impl item)
/// Should be removed once https://github.com/cryspen/hax/issues/1646 has been fixed
pub fn is_precondition(self) -> bool {
self.0.get().is_precondition()
}

/// Returns true if the underlying identifier is a postcondition (trait/impl item)
/// Should be removed once https://github.com/cryspen/hax/issues/1646 has been fixed
pub fn is_postcondition(self) -> bool {
self.0.get().is_postcondition()
}

/// Renders a view of the concrete identifier.
pub fn view(self) -> view::View {
ConcreteId::from_global_id(self).view()
Expand Down Expand Up @@ -380,6 +392,18 @@ impl GlobalIdInner {
_ => false,
}
}

/// Returns true if the underlying identifier has the precondition suffix
/// Should be removed once https://github.com/cryspen/hax/issues/1646 has been fixed
pub fn is_precondition(&self) -> bool {
matches!(self, GlobalIdInner::Concrete(concrete_id) if matches!(concrete_id.suffix, Some(ReservedSuffix::Pre)))
}

/// Returns true if the underlying identifier has the postcondition suffix
/// Should be removed once https://github.com/cryspen/hax/issues/1646 has been fixed
pub fn is_postcondition(&self) -> bool {
matches!(self, GlobalIdInner::Concrete(concrete_id) if matches!(concrete_id.suffix, Some(ReservedSuffix::Post)))
}
}

impl ConcreteId {
Expand Down
Loading
Loading