Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/2026-02-08T22_02_38+01_00_fix_3141
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FIXED: Clash will no longer error if it finds the same data file more than once due to duplicate `-i` flags [#3141](https://github.com/clash-lang/clash-compiler/issues/3141)
3 changes: 2 additions & 1 deletion clash-lib/src/Clash/Netlist/BlackBox/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import Control.Monad.State (State, StateT (..), lift, gets
import Data.Bitraversable (bitraverse)
import Data.Bool (bool)
import Data.Coerce (coerce)
import Data.Containers.ListUtils (nubOrd)
import Data.Foldable (foldrM)
import Data.Hashable (Hashable (..))
import qualified Data.HashMap.Strict as HashMap
Expand Down Expand Up @@ -332,7 +333,7 @@ canonicalizeDataFilePath idirs toCanonicalize
(canonicalizePath toCanonicalize)
(error [I.i|Could not find data file #{show toCanonicalize}. Does it exist?|])
| otherwise = unsafePerformIO $ do
let candidates = map (</> toCanonicalize) idirs
let candidates = map (</> toCanonicalize) (nubOrd idirs)
found <- filterM doesFileExist candidates
case found of
[] -> error [I.i|
Expand Down
1 change: 1 addition & 0 deletions tests/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ runClashTest = defaultMain
in runTest "T3021" _opts
, let _opts = def { hdlTargets = [VHDL], hdlLoad = [], hdlSim = []}
in runTest "T3084" _opts
, runTest "T3141" def{hdlSim=[], hdlLoad=[], clashFlags=["-itests/shouldwork/Issues/T3141", "-itests/shouldwork/Issues/T3141"]}
] <>
if compiledWith == Cabal then
-- This tests fails without environment files present, which are only
Expand Down
11 changes: 11 additions & 0 deletions tests/shouldwork/Issues/T3141.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module T3141 where

import Clash.Explicit.Prelude

topEntity ::
Clock System ->
Enable System ->
Signal System (Unsigned 4) ->
Signal System (Maybe (Unsigned 4, BitVector 8)) ->
Signal System (BitVector 8)
topEntity clk ena = blockRamFile clk ena d16 "T3141.mem"
Empty file.