agda / agda

Agda is a dependently typed programming language / interactive theorem prover.

Home Page:https://wiki.portal.chalmers.se/agda/pmwiki.php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Internal error in Mimer with module parameter and matching

andreasabel opened this issue · comments

module _ (A : Set) where

open import Agda.Builtin.Nat
open import Agda.Builtin.Sigma

data Color : Set where
  black : Color

data Tree' : Color  Nat  Set where
  nb :  (a : A) {c} {n}
      Tree' c n
      Tree' black n
      Tree' black (suc n)

test :  (a : A) {n} (l : Tree' black (suc n))  Σ _ λ c  Tree' c (suc n)
test a (nb a₁ l l₁) = {!!} --internal error C-c C-a

-- An internal error has occurred. Please report this as a bug.
-- Location of the error: __IMPOSSIBLE__, called at src/full/Agda/TypeChecking/CompiledClause/Match.hs:87:73

Looks like this impossible is hit (last line):

-- done matching
Done xs t
-- if the function was partially applied, return a lambda
| m < n -> yes $ applySubst (toSubst es) $ foldr lam t (drop m xs)
-- otherwise, just apply instantiation to body
-- apply the result to any extra arguments
| otherwise -> yes $ applySubst (toSubst es0) t `applyE` map ignoreReduced es1
where
n = length xs
m = length es
-- at least the first @n@ elims must be @Apply@s, so we can
-- turn them into a subsitution
toSubst = parallelS . reverse . map (unArg . fromMaybe __IMPOSSIBLE__ . isApplyElim . ignoreReduced)