-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ fix #5506 ] by turning the crashed case into a conservative handling
Note: apparently, the author of the blamed commit 8760d15 was convinced of some invariant that was refuted by #5506. It makes sense to go back and investigate whether the invariant was assumed in error or whether something else breaks this invariant.
- Loading branch information
1 parent
e2a6f2d
commit dd552b0
Showing
2 changed files
with
48 additions
and
4 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
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,42 @@ | ||
-- Andreas, 2021-08-18, issue #5506 reported by alexarice | ||
|
||
-- A crash in the forcing methodology introduced in 2.6.1 | ||
-- that surfaced with the removal of auto-inlining in 2.6.2. | ||
|
||
-- {-# OPTIONS --no-forcing #-} -- fixes | ||
-- {-# OPTIONS --auto-inline #-} -- fixes | ||
|
||
{-# OPTIONS -v tc.lhs.unify.force:100 #-} | ||
|
||
open import Agda.Builtin.Nat | ||
|
||
data Unit : Set where | ||
unit : Unit | ||
|
||
data Ctx : Nat → Set where -- index needed | ||
cons : (m : Nat) (A : Unit) → Ctx (suc m) | ||
|
||
mutual | ||
|
||
data P : (n : Nat) (Γ : Ctx n) → Set | ||
|
||
-- Needs to be mutual | ||
{-# NOINLINE getFocus #-} | ||
getFocus : (n : Nat) (A : Unit) → Unit | ||
getFocus n A = A -- needs to be A, not unit | ||
|
||
data P where | ||
c : (n : Nat) -- n is forced | ||
(A : Unit) | ||
→ P (suc n) (cons n (getFocus n A)) | ||
|
||
test : (n : Nat) (Γ : Ctx n) → P n Γ → Nat | ||
test n Γ (c m A) = n + m | ||
-- ^ n := suc m fixes the issue | ||
|
||
-- WAS: | ||
-- Panic: Pattern match failure in do expression at | ||
-- src/full/Agda/TypeChecking/Rules/LHS/Unify.hs:1313:7-14 | ||
-- when checking that the pattern c _ _ _ _ has type P n Γ | ||
|
||
-- Expect: type-checks without errors. |