Skip to content

Commit

Permalink
[ fix agda#5610 ] Bypass typechecking when binding musical coinductio…
Browse files Browse the repository at this point in the history
…n primitives
  • Loading branch information
jespercockx committed Oct 24, 2021
1 parent 2ede73c commit 0c4b13a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/full/Agda/TypeChecking/Rules/Builtin/Coinduction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ typeOfFlat = hPi "a" (el primLevel) $
-- definition.

bindBuiltinInf :: ResolvedName -> TCM ()
bindBuiltinInf x = bindPostulatedName builtinInf x $ \inf _ ->
instantiateFull =<< checkExpr (A.Def inf) =<< typeOfInf
bindBuiltinInf x = bindPostulatedName builtinInf x $ \inf _ -> return $ Def inf []

-- | Binds the SHARP builtin, and changes the definitions of INFINITY
-- and SHARP.
Expand All @@ -64,7 +63,7 @@ bindBuiltinSharp x =
bindPostulatedName builtinSharp x $ \sharp sharpDefn -> do
sharpType <- typeOfSharp
TelV fieldTel _ <- telView sharpType
sharpE <- instantiateFull =<< checkExpr (A.Def sharp) sharpType
let sharpE = Def sharp []
Def inf _ <- primInf
infDefn <- getConstInfo inf
addConstant (defName infDefn) $
Expand Down Expand Up @@ -111,7 +110,7 @@ bindBuiltinSharp x =
bindBuiltinFlat :: ResolvedName -> TCM ()
bindBuiltinFlat x =
bindPostulatedName builtinFlat x $ \ flat flatDefn -> do
flatE <- instantiateFull =<< checkExpr (A.Def flat) =<< typeOfFlat
let flatE = Def flat []
Def sharp _ <- primSharp
kit <- requireLevels
Def inf _ <- primInf
Expand Down
12 changes: 12 additions & 0 deletions test/Succeed/Issue5610.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{-# OPTIONS --type-in-type #-}

infix 1000 ♯_

postulate
: {a} (A : Set a) Set a
♯_ : {a} {A : Set a} A ∞ A
: {a} {A : Set a} ∞ A A

{-# BUILTIN INFINITY ∞ #-}
{-# BUILTIN SHARP ♯_ #-}
{-# BUILTIN FLAT ♭ #-}

0 comments on commit 0c4b13a

Please sign in to comment.