Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce splitAt to undefined in illegal contexts #2835

Merged
merged 1 commit into from
Nov 2, 2024
Merged

Commits on Oct 29, 2024

  1. Reduce splitAt to undefined in illegal contexts

    Previously, the Clash compiler would try to reduce
    
    ```
    splitAt d1 Nil
    ```
    to something of type
    ```
    (Vec 1 a, Vec (0-1) a)
    ```
    by trying to project the head and the tail out of the `Nil`
    constructor. This of course does not work resulting in an
    out-of-bounds indexing error reported in:
    
    #2831
    
    The compiler now reduces above expressions to:
    
    ```
    undefined :: (Vec 1 a, Vec (0-1) a)
    ```
    
    Which is morally equivalent to the run-time exception Haskell
    evaluation would have thrown if the circuit description was
    evaluated like a regular Haskell program.
    
    Fixes #2831
    christiaanb committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    a7fc0e2 View commit details
    Browse the repository at this point in the history