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

Splitting inside lambda using where-block causes unhandled exception #121

Open
mbrea-c opened this issue Jul 29, 2023 · 1 comment
Open

Comments

@mbrea-c
Copy link

mbrea-c commented Jul 29, 2023

Steps to reproduce

  1. Load the following code:
open import Data.Nat using (ℕ)

fails : ℕ
fails = 
  λ where 
  x  ?  -- fails to case split here
  1. Try to case split on x at the goal

Expected result

Variable x is successfully split in cases

Actual result

The following error:

UNHANDLED EXCEPTION ErrorResult nvim_buf_set_text (ObjectArray [ObjectInt 1,ObjectString "'start' is higher than 'end'"])

Where this is used

Afaik using λ where is a common pattern when paired with case_of_ from the Function.Base module in the stdlib. Personally, I use it for type-safety proofs in large developments, where the nesting makes it harder to cleanly use with-abstractions.

Edit: Found some more related weird behaviour. In the following snippet:

open import Data.Nat using (ℕ)

works : ℕ
works = 
  λ { 
  z  ? 
  }

fails : ℕ
fails = 
  λ where 
  x  ? 

case splitting on x in the second goal will actually split z from the first lambda.

@isovector
Copy link
Owner

I think this will be a hard one to fix; last I checked, Agda doesn't give us the buffer range we need to change when it gives splits. If that's still the case, we'd somehow need to figure out the scope of the where block on our own :|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants