-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af4e173
commit 44ab870
Showing
6 changed files
with
90 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FIXES: Fixes issue with one of Clash's transformations, `inlineCleanup`, introducing free variables [#1337](https://github.com/clash-lang/clash-compiler/issues/1337) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{-| | ||
Copyright : (C) 2020, QBayLogic B.V. | ||
License : BSD2 (see the file LICENSE) | ||
Maintainer : QBayLogic B.V. <devops@qbaylogic.com> | ||
-} | ||
{-# LANGUAGE QuasiQuotes #-} | ||
|
||
module Clash.Tests.Normalize.Transformations where | ||
|
||
import Clash.Normalize.Transformations (inlineBndrsCleanup) | ||
import Clash.Core.VarEnv (mkInScopeSet, mkVarSet, mkVarEnv, emptyVarEnv) | ||
import Clash.Core.FreeVars (countFreeOccurances) | ||
import Clash.Core.Term | ||
|
||
import Test.Tasty | ||
import Test.Tasty.HUnit | ||
|
||
import Test.Clash.Rewrite (parseToTermQQ) | ||
|
||
t1337 :: Term | ||
t1337 = Letrec keep1 result | ||
where | ||
(keep0:inlines)= map (\(v,e) -> (v,((v,e),countFreeOccurances e))) binds | ||
is = mkInScopeSet (mkVarSet (map fst binds)) | ||
|
||
keep1 = inlineBndrsCleanup is (mkVarEnv inlines) emptyVarEnv [snd keep0] | ||
|
||
Letrec binds result = | ||
[parseToTermQQ| | ||
let | ||
-- Types don't mean anything for this example | ||
result_1, a_2, b_3, c_4 :: Int | ||
|
||
result_1 = a_2 | ||
|
||
a_2 = b_3 | ||
b_3 = c_4 | ||
c_4 = a_2 b_3 | ||
in | ||
result_1 | ||
|] | ||
|
||
t1337result :: Term | ||
t1337result = [parseToTermQQ| | ||
let | ||
result_1, b_3 :: Int | ||
result_1 = b_3 | ||
b_3 = b_3 b_3 | ||
in | ||
result_1 | ||
|] | ||
|
||
tests :: TestTree | ||
tests = | ||
testGroup | ||
"Clash.Tests.Core.Util.Interpolation" | ||
[ testCase "T1337" $ t1337result @=? t1337 | ||
] |
This file contains 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