+28
-30
lines changedFilter options
+28
-30
lines changed Original file line number Diff line number Diff line change
@@ -99,8 +99,6 @@ import Agda.Utils.Impossible
99
99
100
100
-- | Given the type of a constructor (excluding the parameters),
101
101
-- decide which arguments are forced.
102
-
-- Precondition: the type is of the form @Γ → D vs@ and the @vs@
103
-
-- are in normal form.
104
102
computeForcingAnnotations :: QName -> Type -> TCM [IsForced]
105
103
computeForcingAnnotations c t =
106
104
ifNotM (optForcing <$> pragmaOptions {-then-}) (return []) $ {-else-} do
@@ -109,10 +107,11 @@ computeForcingAnnotations c t =
109
107
-- Andreas, 2015-03-28 Issue 1469: Normalization too costly.
110
108
-- Instantiation also fixes Issue 1454.
111
109
-- Note that normalization of s0 below does not help.
112
-
t <- instantiateFull t
110
+
-- t <- instantiateFull t
113
111
-- Ulf, 2018-01-28 (#2919): We do need to reduce the target type enough to
114
112
-- get to the actual data type.
115
113
-- Also #2947: The type might reduce to a pi type.
114
+
-- Andreas, 2024-07-07, issue #6744, iteratively reduce.
116
115
TelV tel (El _ a) <- telViewPath t
117
116
erasureOn <- optErasure <$> pragmaOptions
118
117
-- Modalities of constructor arguments:
@@ -176,6 +175,9 @@ newtype ForcedVariableCollection' a = ForcedVariableCollection
176
175
-- Needed for HasConstInfo:
177
176
, MonadFail, MonadDebug, MonadTCEnv, HasOptions
178
177
, HasConstInfo
178
+
-- Neded for MonadReduce:
179
+
, ReadTCState
180
+
, MonadReduce
179
181
)
180
182
181
183
type ForcedVariableCollection = ForcedVariableCollection' ()
@@ -233,7 +235,8 @@ instance ForcedVariables a => ForcedVariables (Arg a) where
233
235
234
236
-- | Assumes that the term is in normal form.
235
237
instance ForcedVariables Term where
236
-
forcedVariables = \case
238
+
-- Andreas, 2024-07-07, issue #6744, add reduction.
239
+
forcedVariables v = reduce v >>= \case
237
240
Var i [] -> singleton (i, unitModality)
238
241
Con c _ vs -> ifM (consOfHIT $ conName c) mempty $ {-else-} forcedVariables vs
239
242
_ -> mempty
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1
+
-- Andreas, 2024-07-07, issue #6744, reported and testcase by Jesper.
2
+
3
+
-- Reduction needed in forcing analysis.
4
+
5
+
{-# OPTIONS --erasure #-}
6
+
7
+
-- {-# OPTIONS -v tc.force:60 #-}
8
+
9
+
open import Agda.Builtin.Nat
10
+
11
+
-- This alias fools the forcing analysis of Agda 2.6.4 and below:
12
+
suc' : Nat → Nat
13
+
suc' = suc
14
+
15
+
data D : Nat → Set where
16
+
c : (@0 n : Nat) → D (suc' n)
17
+
18
+
foo : (n : Nat) → D n → Set
19
+
foo n (c _) = Nat
20
+
21
+
-- Should be accepted.
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4