From 1f62391b58ca63d77aac1d0fd18b68b4aa13552a Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 17 Feb 2025 15:36:59 -0500 Subject: [PATCH] Fix compiler bug; Rewrite CI workflow --- .github/workflows/rust.yml | 14 ++++++-------- dust-lang/src/compiler/mod.rs | 10 +++++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c1b19e7..7e93ae7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,21 +1,19 @@ -name: Dust Tests +name: Cargo Build & Test on: push: - branches: ["main"] pull_request: - branches: ["main"] env: CARGO_TERM_COLOR: always jobs: - build: + build_and_test: + name: Dust Build & Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - run: rustup update nightly && rustup default nightly + - run: cargo build --verbose + - run: cargo test --verbose --no-fail-fast diff --git a/dust-lang/src/compiler/mod.rs b/dust-lang/src/compiler/mod.rs index b92c0d3..3954690 100644 --- a/dust-lang/src/compiler/mod.rs +++ b/dust-lang/src/compiler/mod.rs @@ -1116,12 +1116,20 @@ impl<'src> Compiler<'src> { self.emit_instruction(test, Type::None, operator_position); self.emit_instruction(jump, Type::None, operator_position); + let instruction_count_before_right = self.instructions.len(); + self.advance()?; self.parse_sub_expression(&rule.precedence)?; // TODO: Check if the right type is boolean - if matches!( + if self.instructions.len() == instruction_count_before_right + 1 { + self.instructions + .last_mut() + .unwrap() + .0 + .set_a_field(left.index()); + } else if matches!( self.get_last_operations(), Some([ Operation::EQUAL | Operation::LESS | Operation::LESS_EQUAL,