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: Drop SelectOpt from MutableMap #992

Merged
merged 7 commits into from
Nov 19, 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
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ pub mod DafnyLibraries {
}
}

impl<K: ::dafny_runtime::DafnyTypeEq, V: ::dafny_runtime::DafnyTypeEq>
::dafny_runtime::UpcastObject<dyn ::std::any::Any> for MutableMap<K, V>
{
::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any);
}

pub mod FileIO {
use std::fs::File;
use std::io::Read;
Expand All @@ -89,7 +95,12 @@ pub mod DafnyLibraries {

let mut file = match File::open(path) {
Err(why) => {
let err_msg = format!("couldn't open {} for reading from {}: {}", path.display(), curr_dir(), why);
let err_msg = format!(
"couldn't open {} for reading from {}: {}",
path.display(),
curr_dir(),
why
);
let err_msg = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&err_msg);
return (true, dafny_runtime::Sequence::default(), err_msg);
}
Expand All @@ -111,8 +122,7 @@ pub mod DafnyLibraries {
}
}

fn curr_dir() -> String
{
fn curr_dir() -> String {
let path = std::env::current_dir();
match path {
Ok(path) => format!("{}", path.display()),
Expand All @@ -137,7 +147,12 @@ pub mod DafnyLibraries {
.open(path);
let mut file = match maybe_file {
Err(why) => {
let err_msg = format!("couldn't open {} for writing from {}: {}", path.display(), curr_dir(), why);
let err_msg = format!(
"couldn't open {} for writing from {}: {}",
path.display(),
curr_dir(),
why
);
let err_msg = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&err_msg);
return (true, err_msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
import java.util.Map;
import java.util.concurrent.*;

public class MutableMap<K, V>
extends DafnyLibraries._ExternBase_MutableMap<K, V> {
public class MutableMap<K, V> implements DafnyLibraries.MutableMapTrait<K, V> {

private ConcurrentHashMap<K, V> m;

public MutableMap(
dafny.TypeDescriptor<K> _td_K,
dafny.TypeDescriptor<V> _td_V
) {
super(_td_K, _td_V);
m = new ConcurrentHashMap<K, V>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def Unlock(self):
self.lock.release()


class MutableMap(smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries.MutableMap):
class MutableMap(smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries.MutableMapTrait):
def ctor__(self):
pass

Expand Down
2 changes: 1 addition & 1 deletion libraries
Loading