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

Let bindings in module telescopes crash Agda.Interaction.BasicOps #2552

Closed
asr opened this issue Apr 20, 2017 · 3 comments
Closed

Let bindings in module telescopes crash Agda.Interaction.BasicOps #2552

asr opened this issue Apr 20, 2017 · 3 comments
Assignees
Labels
let-telescopes modules Issues relating to the module system parameters Module parameters type: bug Issues and pull requests about actual bugs ux: interaction Issues to do with interactive development (holes, case splitting, etc)
Milestone

Comments

@asr
Copy link
Member

asr commented Apr 20, 2017

MWE of an issue privately reported by @mechvel:

open import Data.Nat

module Foo (let foo = zero) where

-- When asking for the contents of the module `bar` (which it isn't
-- defined) via C-c C-o, I got the the internal error:

-- An internal error has occurred. Please report this as a bug.
-- Location of the error: src/full/Agda/Interaction/BasicOps.hs:866
@asr asr added the type: bug Issues and pull requests about actual bugs label Apr 20, 2017
@andreasabel andreasabel self-assigned this Apr 20, 2017
@andreasabel andreasabel changed the title Internal error in Agda.Interaction.BasicOps.hs Let bindings in module telescopes crash Agda.Interaction.BasicOps Apr 20, 2017
@andreasabel andreasabel added ux: interaction Issues to do with interactive development (holes, case splitting, etc) let-telescopes modules Issues relating to the module system parameters Module parameters labels Apr 20, 2017
@andreasabel andreasabel added this to the 2.5.3 milestone Apr 20, 2017
@andreasabel
Copy link
Member

andreasabel commented Apr 20, 2017

The code fixing #317 no longer works, as we have let-bindings in module parameters. Also, it would not work with parameter-refinement.

The proper way to fix this issue would be to represent let-bindings also in the section telescopes in internal syntax. Then one could, for instance, also ask for the value of zero interactively, with C-c C-n zero.

The quicker way to partially repair this is to store with LocalVar in the scope checker whether it is a let-bound variable, and delete all let-bound variables from the scope for interactive commands (since we do not have their types nor their definitions). The remaining locals can then be matched with the section telescope (assuming it has not be reordered).

@andreasabel
Copy link
Member

Example not using the std-lib:

{-# OPTIONS -v interaction.top:20 #-}

open import Agda.Primitive

module _ (let foo = lzero) (A : Set) where

-- C-c C-o bar

@andreasabel
Copy link
Member

I am fixing this by dropping let-bound variables from the telescope when preparing the context for top-level command execution.
Resolves the original issue, but referring to foo is still broken, yields an unbound-variable panic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
let-telescopes modules Issues relating to the module system parameters Module parameters type: bug Issues and pull requests about actual bugs ux: interaction Issues to do with interactive development (holes, case splitting, etc)
Projects
None yet
Development

No branches or pull requests

2 participants