Skip to content

Commit 0ffd62e

Browse files
committed
Improve blackbox error message
This changes the error when using non-existant arguments in blackboxes from: Blackbox required at least 32 arguments, but only 8 were passed. to the new error: Blackbox used "~ISSYNC[31]" , but only 8 arguments were passed.
1 parent 3c2c4cc commit 0ffd62e

File tree

1 file changed

+5
-4
lines changed
  • clash-lib/src/Clash/Netlist/BlackBox

1 file changed

+5
-4
lines changed

clash-lib/src/Clash/Netlist/BlackBox/Util.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,11 @@ verifyBlackBoxContext bbCtx (N.BBTemplate t) =
185185
Just n ->
186186
case indexMaybe (bbInputs bbCtx) n of
187187
Just _ -> Nothing
188-
Nothing ->
189-
Just ( "Blackbox required at least " ++ show (n+1)
190-
++ " arguments, but only " ++ show (length (bbInputs bbCtx))
191-
++ " were passed." )
188+
Nothing -> do
189+
let str = fromJust (fmap Text.unpack (getAp $ prettyElem e))
190+
Just ( "Blackbox used \"" ++ str ++ "\""
191+
++ ", but only " ++ show (length (bbInputs bbCtx))
192+
++ " arguments were passed." )
192193

193194
extractLiterals :: BlackBoxContext
194195
-> [Expr]

0 commit comments

Comments
 (0)