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

Local definitions in irrelevant definitions are incorrectly checked for relevance #302

Open
ohad opened this issue Apr 21, 2020 · 4 comments

Comments

@ohad
Copy link

ohad commented Apr 21, 2020

I thought we discussed/reported this at some point, but I can't find the report/fix.

Steps to Reproduce

$ cat Irrel.idr 
0
foo : (0 b : Bool) -> Bool
foo b = b

0
bar : Bool
bar = q
  where
    q : Bool
    q = foo True

0
baz : Bool
bar = let q : Bool
          q = foo True in
      q

$ idris2 -c Irrel.idr 

Expected Behavior

1/1: Building Irrel (Irrel.idr)

Observed Behavior

1/1: Building Irrel (Irrel.idr)
Irrel.idr:10:9--12:1:While processing right hand side of bar at Irrel.idr:7:1--12:1:
While processing right hand side of bar,q at Irrel.idr:10:5--12:1:
Main.foo is not accessible in this context
Irrel.idr:15:15--15:24:While processing right hand side of bar at Irrel.idr:14:1--19:1:
While processing right hand side of bar,q at Irrel.idr:15:11--15:24:
Main.foo is not accessible in this context
@edwinb
Copy link
Owner

edwinb commented Apr 21, 2020

Hmm, it's probably just not propagating the multiplicity to the local definition properly. You probably at least noticed that you can work around this for now with an explicit annotation on q. (Also that your last bar should be baz :))

@ziman
Copy link
Collaborator

ziman commented Apr 21, 2020

Assuming that let (omega q : Bool) = foo True in q should be equivalent to (\omega q : Bool => q) (foo True), this should typecheck because the result of the lambda is used zero times.

So I don't think the annotation on q is inferred wrong. I think that the type checker should accept an omega there; is that right?

@ohad
Copy link
Author

ohad commented Apr 21, 2020

@ziman : This is a local definition, and not a let-binding. See the README

@ziman
Copy link
Collaborator

ziman commented Apr 21, 2020

Oh, I see, thanks!

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

3 participants