Closed johannes-riecken closed 2 months ago
There's a warning about shadowing:
|-- Issue3379.idr line 16 col 0:
| We are about to implicitly bind the following lowercase names.
| You may be unintentionally shadowing the associated global definitions:
| or' is shadowing Main.or'
|
| Issue3379:16:1--16:2
| 12 | g : (x : Bool) -> or' x False = x
| 13 | g False = Refl
| 14 | g True = Refl
| 15 |
| 16 | f : (z : Bool) -> foldl or' z (the (Vect 2 Bool) [False, False]) = z
| ^
so you wrote something you did not mean: or'
is universally quantified in the type of f
but when you call g
you talk about the one defined earlier in the file.
Thanks for the explanation. My bad, I didn't see the warning as I just used the reload functionality of the Vim plugin instead of running Idris2 Issue3379.idr
, and with Main.odr'
in the type of f
it works. So an imported definition will always be in scope, but lowercase definitions in the Main module always need to be qualified in type signatures? Feel free to close the issue.
It's only an issue when it's not applied (that's why it's an issue when it's passed
as an argument to foldl
but not in or' x False
where it's applied to 2 arguments).
IMO the automatic generalisation of implicit names should be declare before use but unfortunately it's not the case.
Here's a very small file that fails to type-check.
Steps to Reproduce
Type-check the file with Idris2 0.7.0. Notice that type-checking succeeds when changing to a
Vect
of size 1 and adapting things accordingly.Expected Behavior
Type-checking succeeds (or an understandable error message if it should fail here).
Observed Behavior