Skip to content

Commit f35602a

Browse files
committed
document what the issue is with upstream treeless
1 parent cc26686 commit f35602a

File tree

4 files changed

+12
-29
lines changed

4 files changed

+12
-29
lines changed

src/Agda/Utils.hs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,6 @@ isArity typ = do
8282
-- | Convert compiled clauses to treeless syntax, and return it.
8383
treeless :: QName -> TCM (Maybe TTerm)
8484
treeless = CustomTT.toTreeless EagerEvaluation
85-
-- TT.toTreelessWith pipeline (EagerEvaluation, TT.EraseUnused)
86-
{-
87-
where
88-
pipeline v q = TT.Sequential []
89-
TT.Sequential
90-
-- NOTE (flupe): this is the default Agda treeless pipeline
91-
-- with the builtin pass removed.
92-
-- [ TT.compilerPass "builtin" (30 + v) "builtin translation" $ const TT.translateBuiltins
93-
[ TT.FixedPoint 5 $ TT.Sequential
94-
[ -- TT.compilerPass "simpl" (30 + v) "simplification" $ const TT.simplifyTTerm
95-
-- TT.compilerPass "erase" (30 + v) "erasure" $ TT.eraseTerms q
96-
-- , TT.compilerPass "uncase" (30 + v) "uncase" $ const TT.caseToSeq
97-
-- , TT.compilerPass "aspat" (30 + v) "@-pattern recovery" $ const TT.recoverAsPatterns
98-
]
99-
-- , TT.compilerPass "id" (30 + v) "identity function detection" $ const (TT.detectIdentityFunctions q)
100-
101-
-- NOTE(flupe): actually, we also remove case defaults to add a branch for all constructors
102-
-- , TT.compilerPass "defaults" (30 + v) "eliminate case defaults" $ const TT.eliminateCaseDefaults
103-
]
104-
-}
105-
106-
10785

10886
-- * projections
10987

src/Agda/Utils/EliminateDefaults.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module Agda.Utils.EliminateDefaults where
1717

1818
import Control.Monad
1919
import qualified Data.List as List
20+
import Control.Monad.IO.Class (liftIO)
2021

2122
import Agda.Syntax.Treeless
2223
import Agda.TypeChecking.Monad
@@ -25,7 +26,9 @@ import Agda.Compiler.Treeless.Subst () --instance only
2526

2627

2728
eliminateCaseDefaults :: TTerm -> TCM TTerm
28-
eliminateCaseDefaults = tr
29+
eliminateCaseDefaults term = do
30+
liftIO $ putStrLn "hello"
31+
tr term
2932
where
3033
tr :: TTerm -> TCM TTerm
3134
tr = \case

src/Agda/Utils/EtaExpandConstructors.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ etaExpandConstructors t | Just (q, args) <- unSpineCon t = do
3636
let nlam = arity - nargs
3737
exargs <- mapM (etaExpandConstructors . raise nlam) args
3838
let vars = TVar <$> reverse [0 .. nlam - 1]
39-
liftIO $ putStrLn $ show vars
4039
pure $ iterate TLam (TApp (TCon q) $ exargs ++ vars) !! nlam
4140

4241
etaExpandConstructors t = case t of

src/Agda/Utils/Treeless.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
{-# LANGUAGE NamedFieldPuns, OverloadedStrings #-}
2+
{- NOTE(flupe):
3+
4+
Currently we inline the treeless pipeline from the Agda source.
5+
The reason is simple: there is a bug in the pipeline that makes
6+
the compiler ignore the user-provided pipeline in recursive calls to treeless.
7+
Since the treeless compilation is cached (?), it is never recomputed with the right pipeline.
8+
9+
-}
210
module Agda.Utils.Treeless
311
( toTreeless
412
, toTreelessWith
@@ -174,11 +182,6 @@ compilerPass tag v name code = SinglePass (CompilerPass tag v name code)
174182
compilerPipeline :: BuildPipeline
175183
compilerPipeline v q =
176184
Sequential
177-
-- Issue #4967: No simplification step before builtin translation! Simplification relies
178-
-- on either all or no builtins being translated. Since we might have inlined
179-
-- functions that have had the builtin translation applied, we need to apply it
180-
-- first.
181-
-- [ compilerPass "simpl" (35 + v) "simplification" $ const simplifyTTerm
182185

183186
-- [ compilerPass "builtin" (30 + v) "builtin translation" $ const translateBuiltins
184187
[ FixedPoint 5 $ Sequential

0 commit comments

Comments
 (0)