Skip to content

Commit 9f0d1f3

Browse files
committed
Fix bug in clearing previously-set keys.
1 parent f2757dc commit 9f0d1f3

File tree

11 files changed

+31
-10
lines changed

11 files changed

+31
-10
lines changed

Cargo.lock

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ergo/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ergo"
3-
version = "1.0.0-rc.2"
3+
version = "1.0.0-rc.3"
44
authors = ["Alex Franchuk <afranchuk@caci.com>"]
55
edition = "2021"
66

ergo/ChangeLog.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ergo changelog
22

3+
## 1.0.0-rc.3 -- 2021-12-14
4+
* Properly remove previously-set keys when a key is set to `unset`.
5+
* With the recent modification to how unset values are removed this case was
6+
missed.
7+
38
## 1.0.0-rc.2 -- 2021-12-13
49
* Remove `Unset` keyed arguments to commands just like they are removed from
510
maps.

ergo/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,4 @@ scripts reside.
9494
* Maybe don't have a fallback doc string if there is no documentation set.
9595
* Progress spinner
9696
* Improve sources of capture bindings.
97+
* `std:Iter:partition`

ergo_runtime/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ergo_runtime"
3-
version = "1.0.0-rc.2"
3+
version = "1.0.0-rc.3"
44
authors = ["Alex Franchuk <afranchuk@caci.com>"]
55
edition = "2021"
66

ergo_runtime_macro/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ergo_runtime_macro"
3-
version = "1.0.0-rc.2"
3+
version = "1.0.0-rc.3"
44
authors = ["Alex Franchuk <afranchuk@caci.com>"]
55
edition = "2021"
66

ergo_script/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ergo_script"
3-
version = "1.0.0-rc.2"
3+
version = "1.0.0-rc.3"
44
authors = ["Alex Franchuk <afranchuk@caci.com>"]
55
edition = "2021"
66

ergo_script/src/eval.rs

+2
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ impl Evaluator {
481481

482482
if !v.is_type::<types::Unset>() {
483483
env.insert(k, v.clone());
484+
} else {
485+
env.remove(&k);
484486
}
485487
if let Some(cap) = cap {
486488
captures.resolve(cap, v);

ergo_script/src/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,16 @@ mod test {
475475
)
476476
}
477477

478+
#[test]
479+
fn set_and_unset() -> Result<(), String> {
480+
script_eval_to("{a = 1, a = :unset}", SRMap(&[]))
481+
}
482+
483+
#[test]
484+
fn merge_and_unset() -> Result<(), String> {
485+
script_eval_to("m = {a = 1}, {^:m, a = :unset}", SRMap(&[]))
486+
}
487+
478488
#[test]
479489
fn forced_function_capture() -> Result<(), String> {
480490
script_eval_to("b = {a = 1}; f = !(fn :x -> b::x); f a", SRString("1"))

ergo_std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ergo_std"
3-
version = "1.0.0-rc.2"
3+
version = "1.0.0-rc.3"
44
authors = ["Alex Franchuk <afranchuk@caci.com>"]
55
edition = "2021"
66

ergo_std/ChangeLog.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ergo_std changelog
22

3+
## 1.0.0-rc.3 -- 2021-12-14
4+
* No changes.
5+
36
## 1.0.0-rc.2 -- 2021-12-13
47
* Add `std:io:is-terminal` to check whether a stream is connected to a terminal.
58
* Add `std:fs:file-type` to get the file type of a path.

0 commit comments

Comments
 (0)