Fix multiple issues: type inference, syntax, CI, and correctness#6
Merged
Fix multiple issues: type inference, syntax, CI, and correctness#6
Conversation
Detect available CPU cores and pass -j flag to make tests for parallel execution. Supports Linux (lscpu), macOS (sysctl), with fallback to 1. https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
…ements - Add explicit a:Type constraints to odd_sized_palindrome and pad_to_power_of_2 - Add explicit type annotations to butterfly_ixs return values - Add explicit index types to for loops throughout fft.dx - Cast zero to Complex explicitly for pad_to_power_of_2 calls - Use each instead of map in fft-tests.dx - Add index type annotations to 2D FFT functions https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
…equirements - Add explicit a:Type constraints to last, first, all_except_last - Use Fin directly in all_except_last instead of intermediate variable - Reorder reduce arguments to match current signature - Add type annotation to lambda in set_intersect - Update comment syntax from -- to # in set-tests.dx https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
The compiler couldn't synthesize the Ix instance for the return type of butterfly_ixs when called from power_of_2_fft. Added a type alias and explicit tuple annotation to resolve the inference. https://claude.ai/code/session_016T3EsHh2mTDh4e8Rbt8KJH
pow(0+0i, z) returned NaN because log(0) = -inf, and multiplying the imaginary component by -inf produced NaN via IEEE 754 rules (0 * inf = NaN). Special-case zero base: return 0 when Re(power) > 0. https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
…egation Float64 was missing a VSpace instance, causing "can't synthesize a class dictionary for: (VSpace Float64)" when using unary negation. The neg function requires VSpace, so Float64 negation was impossible. https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
…arrow operators The function composition operators >>> and <<< were placed at lower precedence than -> and =>>, causing expressions like (exp >>> sq) to be misparsed as function application rather than composition. Move them above arrow operators so they bind tighter, matching the design intent documented in syntax-philosophy.md. https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
The VSpace interface uses Float (Float32) as the scalar type, so the Float64 instance needs f_to_f64 conversion before multiplying. https://claude.ai/code/session_016T3EsHh2mTDh4e8Rbt8KJH
The scan and fold functions had pure-only type signatures for their
body parameters, preventing effectful operations inside them despite
the underlying run_state implementation supporting effects. Generalize
the body type to allow arbitrary effects via {|eff}.
https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
After the TypeScript switch, static/index.ts is the source file and static/index.js is generated. Add index.ts to data-files so it's included in source distributions. https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
…ug builds The DEX_DEBUG code path uses unsafePerformIO but the import was missing, causing compilation failures when DEX_DEBUG is enabled (including CI via DEX_CI). https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
…ned types The compiler unconditionally emitted SDiv/SRem (signed division and remainder) for all integer types, producing wrong results for unsigned types like Word8/Word32/Word64. Now dispatches to UDiv/URem based on the operand's base type. https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
…L definitions When a variable definition failed (e.g. due to a typo), the REPL registered the name with a "failed" marker in the source map via uDeclErrSourceMap. This prevented future redefinition attempts with "variable already defined". Stop poisoning the namespace on failure so users can correct their mistakes and redefine. https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
…ut extra parens The parser rejected non-parenthesized function types (A -> B) in struct fields and data constructors with "Argument types should be in parentheses". Now treats unparenthesized arrow LHS as an anonymous binder, so "Int -> Int" desugars to "(_:Int) -> Int", matching user expectations for function-typed fields. https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
… inside strings The lineComment parser consumed everything from # to end of line, including when # appeared before a string delimiter (e.g. in expressions like s = "#text"). Add notFollowedBy check so #" is not treated as a comment start, allowing the string literal parser to handle it. https://claude.ai/code/session_01N4W4JdwHYfmusD4PuxRqbv
…avoid NaN" This reverts commit 4249679.
…ds without extra parens" This reverts commit 25d6ddc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes ported from upstream issues and PRs in google-research/dex-lang:
#inside strings>>>and<<<to higher precedence than arrow operatorsReverted
These were attempted but reverted due to issues:
Test plan
#🤖 Generated with Claude Code