Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when checking pragma BUILTIN SHARP #5610

Closed
berndlosert opened this issue Oct 20, 2021 · 4 comments · Fixed by #5615
Closed

Panic when checking pragma BUILTIN SHARP #5610

berndlosert opened this issue Oct 20, 2021 · 4 comments · Fixed by #5615
Assignees
Labels
builtin Enhancements to the builtin modules and builtin definitions coinduction Coinductive records, musical coinduction internal-error Concerning internal errors of Agda regression in 2.6.1 Regression that first appeared in Agda 2.6.1 type-in-type
Milestone

Comments

@berndlosert
Copy link

berndlosert commented Oct 20, 2021

Agda panics when type-checking this code:

{-# 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     ♭  #-}

The error is:

Panic: Pattern match failure in do expression at
src/full/Agda/TypeChecking/Rules/Builtin/Coinduction.hs:68:5-13
when checking the pragma BUILTIN SHARP ♯_

If I remove {-# OPTIONS --type-in-type #-}, it works again. I'm not sure if this is a bug or intended behavior.

@berndlosert
Copy link
Author

I'm using 2.6.2 by the way.

@andreasabel andreasabel added builtin Enhancements to the builtin modules and builtin definitions coinduction Coinductive records, musical coinduction internal-error Concerning internal errors of Agda type-in-type regression in 2.6.1 Regression that first appeared in Agda 2.6.1 labels Oct 24, 2021
@andreasabel
Copy link
Member

andreasabel commented Oct 24, 2021

Thanks for the report @berndlosert!
Still works with 2.6.0, first breaks with 2.6.1.

I think the error location is still accurate:

@andreasabel
Copy link
Member

Bisection says: 7807e9a is the first bad commit
Date: Tue Oct 15 14:16:10 2019 +0200
[ fix #3073 ] Don't eta-contract \x -> f l to f when --type-in-type
Ping @jespercockx

This looks plausible, because eta-contraction could have produced the Def form that is matched against at the problematic position.

@andreasabel andreasabel added this to the 2.6.3 milestone Oct 24, 2021
jespercockx added a commit to jespercockx/agda that referenced this issue Oct 24, 2021
@jespercockx jespercockx self-assigned this Oct 24, 2021
@andreasabel
Copy link
Member

The proposed fix 74f92b5 can be directly exploited, see #5614 (comment).

@andreasabel andreasabel reopened this Oct 25, 2021
jespercockx added a commit to jespercockx/agda that referenced this issue Oct 25, 2021
@andreasabel andreasabel linked a pull request Oct 25, 2021 that will close this issue
jespercockx added a commit to jespercockx/agda that referenced this issue Oct 25, 2021
jespercockx added a commit to jespercockx/agda that referenced this issue Nov 3, 2021
andreasabel pushed a commit that referenced this issue Nov 3, 2021
Re-insert necessary checks on types of built-in coinduction primitives.
Add tests for wrong definitions of primitives.
@andreasabel andreasabel modified the milestones: 2.6.3, 2.6.2.1 Nov 3, 2021
andreasabel pushed a commit that referenced this issue Nov 17, 2021
Re-insert necessary checks on types of built-in coinduction primitives.
Add tests for wrong definitions of primitives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtin Enhancements to the builtin modules and builtin definitions coinduction Coinductive records, musical coinduction internal-error Concerning internal errors of Agda regression in 2.6.1 Regression that first appeared in Agda 2.6.1 type-in-type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants