Idris-dev icon indicating copy to clipboard operation
Idris-dev copied to clipboard

Overly eager implicitly bound name checker

Open 0xd34df00d opened this issue 6 years ago • 0 comments

Steps to Reproduce

  1. Create a file Sample.idr with the following contents:
record Foo where
  constructor MkFoo
  someN : Nat
  somePrf : someN = S someNPred
  -- somePrf : someNPred `LT` someN -- this works fine
  1. Start up a fresh Idris repl as in idris.
  2. Do :l Sample.idr

Expected Behavior

The file loads fine without any warnings.

Observed Behavior

Type checking ./Sample.idr
Sample.idr:4:13-17:
  |
4 |   somePrf : someN = S someNPred
  |             ~~~~~
someN is bound as an implicit
        Did you mean to refer to Main.Foo.someN?

Note that :doc Foo renders the second occurrence of someN as if it's not an implicit but a reference to the ctor argument, as expected. And, in general, the type behaves as expected.

Also note that using the somePrf version with the LT predicate (as in the commented source line) doesn't give this warning.

0xd34df00d avatar Sep 14 '19 16:09 0xd34df00d