Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and improve contract generation optimization for static types #2017

Merged
merged 5 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 10 additions & 5 deletions core/src/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ impl Ident {
pub fn into_label(self) -> String {
self.label().to_owned()
}

/// Create a new fresh identifier. This identifier is unique and is guaranteed not to collide
/// with any identifier defined before. Generated identifiers start with a special prefix that
/// can't be used by normal, user-defined identifiers.
pub fn fresh() -> Self {
increment!("Ident::fresh");
Self::new(format!("{}{}", GEN_PREFIX, GeneratedCounter::next()))
}
}

impl fmt::Display for Ident {
Expand Down Expand Up @@ -122,12 +130,9 @@ impl LocIdent {
LocIdent { pos, ..self }
}

/// Create a new fresh identifier. This identifier is unique and is guaranteed not to collide
/// with any identifier defined before. Generated identifiers start with a special prefix that
/// can't be used by normal, user-defined identifiers.
/// Create a fresh identifier with no position. See [Ident::fresh].
pub fn fresh() -> Self {
increment!("LocIdent::fresh");
Self::new(format!("{}{}", GEN_PREFIX, GeneratedCounter::next()))
Ident::fresh().into()
}

/// Return the identifier without its position.
Expand Down
1 change: 1 addition & 0 deletions core/src/stdlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub mod internals {
generate_accessor!(record_contract);
generate_accessor!(record_type);
generate_accessor!(forall_record_tail);
generate_accessor!(forall_record_tail_excluded_only);
generate_accessor!(dyn_tail);
generate_accessor!(empty_tail);

Expand Down
Loading