Skip to content

Commit

Permalink
fix a bug with unpack inversion
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Feb 26, 2024
1 parent 8503864 commit 53bcfdb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name = "uiua"
readme = "readme.md"
repository = "https://github.com/uiua-lang/uiua"
rust-version = "1.75"
version = "0.9.1"
version = "0.9.2"

[dependencies]
# Core dependencies
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
Uiua is not yet stable.
<!-- This version is not yet released. If you are reading this on the website, then these changes are live here. -->

## 0.9.2 - 2024-02-25
### Interpreter
- Fix a bug involving patterns like `°°[…]`

## 0.9.1 - 2024-02-25
### Crate
- Improve Rust library API for getting bindings' values

## 0.9.0 - 2024-02-25
Expand Down
6 changes: 3 additions & 3 deletions src/algorithm/invert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ pub(crate) fn invert_instrs(instrs: &[Instr], comp: &mut Compiler) -> Option<Eco
return Some(EcoVec::new());
}

// println!("inverting {:?}", instrs);

let patterns: &[&dyn InvertPattern] = &[
&invert_call_pattern,
&invert_dump_pattern,
Expand Down Expand Up @@ -132,6 +130,8 @@ pub(crate) fn invert_instrs(instrs: &[Instr], comp: &mut Compiler) -> Option<Eco
&invert_temp_pattern,
];

// println!("inverting {:?}", instrs);

let mut inverted = EcoVec::new();
let mut curr_instrs = instrs;
'find_pattern: loop {
Expand Down Expand Up @@ -1116,7 +1116,7 @@ fn invert_unpack_pattern<'a>(
span: *span,
boxed: *unbox,
});
Some((input, instrs))
Some((&[], instrs))
}

fn under_unpack_pattern<'a>(
Expand Down
2 changes: 2 additions & 0 deletions tests/under.ua
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
⍤⟜≍: ⊃(⍜°⊟+|⍜°[⊙∘]+) [1 2] 4
⍤⟜≍: [¯1 ¯2 ¯3] [⍜[⊙⊙∘]¯ 1 2 3]
⍤⟜≍: [¯1 ¯2 ¯3 ¯4] [⍜[⊙⊙⊙∘]¯ 1 2 3 4]
⍤⟜≍: [1 2 3] ⍜[+1]∘ [1 2 3]
⍤⟜≍: [[2 3 4]] °°[+1] [1 2 3]

⍤⟜≍: ¯18 ⍜(⍥(+1)4)¯ 10
⍤⟜≍: ¯18 ⍜⍥(+1)¯ 4 10
Expand Down
3 changes: 0 additions & 3 deletions tests/units.ua
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,6 @@ G ← (⚂)
⍤⟜≍: 1 ⧻◴ [F F F]
⍤⟜≍: 3 ⧻◴ [G G G]

# Unique
⍤⟜≍: 1 1

# Macros
F! ← ^!5
G! ← F!^!
Expand Down

0 comments on commit 53bcfdb

Please sign in to comment.