Skip to content

fix: remove redundant type checks flagged by compiler#138

Open
gilbertwong96 wants to merge 3 commits into
elixir-tools:mainfrom
gilbertwong96:fix/remove-redundant-type-checks
Open

fix: remove redundant type checks flagged by compiler#138
gilbertwong96 wants to merge 3 commits into
elixir-tools:mainfrom
gilbertwong96:fix/remove-redundant-type-checks

Conversation

@gilbertwong96

@gilbertwong96 gilbertwong96 commented Jun 28, 2026

Copy link
Copy Markdown

The compiler emitted two warnings for checks that are always true or always false due to prior type narrowing.

In Spitfire.Env.expand/3, the :import clause re-checked is_atom(arg) inside a with despite the enclosing if is_atom(arg) do already narrowing arg to atom(). Dropped the redundant guard, matching the sibling :require clause.

In Spitfire.skip_call_args/2, the first cond clause (token == nil or token == :eof) already handles :eof, so the trailing token == :eof in the second clause compared disjoint types and was dead. Removed it.

Also bumps the toolchain to Erlang 29 / Elixir 1.20:

  • .mise.toml, flake.nix, and release.yaml versions aligned (CI uses nix develop and reads these automatically)
  • mix.lock deps (credo, file_system, jason)
  • test/spitfire_test.exs reformatted under the 1.20 formatter

- Drop redundant is_atom/1 in import clause (already guarded by outer if)
- Remove dead token == :eof in skip_call_args (already handled by prior clause)
- .mise.toml: erlang 27.2 -> 29.0.2, elixir 1.18.2 -> 1.20.1-otp-29
- flake.nix: beam packages erlang_27/elixir_1_18 -> erlang_29/elixir_1_20
- release.yaml: otp 27.0 -> 29.0, elixir 1.17.x -> 1.20.x
- mix.lock: credo, file_system, jason
- reformat test/spitfire_test.exs under 1.20 formatter
The previous pin (rev fa35a3c8 from Feb 2025) pre-dates the addition of
erlang_29 and elixir_1_20 to nixpkgs, so 'nix develop' failed with
'attribute erlang_29 missing' after the toolchain bump.

Pins nixpkgs to e1c1b847 (Jun 2026) which has both. narHash computed
via gonix nar dump-path and verified against the prior known-good pin.
@mhanberg

Copy link
Copy Markdown
Contributor

Please revert the 1.20/otp29 change.

The parser tests for equality against the core parser and that changes between versions so we only test against the latest version and I haven't made the updates for 1.20 yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants