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

Non-Auto Implicits get Deferred as Holes and not checked on REPL Evaluation #313

Open
fabianhjr opened this issue Apr 22, 2020 · 1 comment

Comments

@fabianhjr
Copy link
Contributor

fabianhjr commented Apr 22, 2020

Steps to Reproduce

Load the following into a repl idris2 Test.idr

module Test

data TNat = TZ | TS TNat

data IsZero : TNat -> Type where
  ItIsZero : IsZero TZ

isZero : (n: TNat) -> {ok: IsZero n} -> Bool
isZero _ = True

isZero' : (n: TNat) -> {auto ok: IsZero n} -> Bool
isZero' _ = True

Expected Behavior

Test> isZero TZ
True
Test> isZero (TS TZ)
(interactive):1:1--1:16:Can't find an implementation for IsZero (TS TZ)
Test> isZero' TZ
True
Test> isZero' (TS TZ)    
(interactive):1:1--1:16:Can't find an implementation for IsZero (TS TZ)
Test> 
Bye for now!

Observed Behavior

Test> isZero TZ
True
Test> isZero (TS TZ)
True                                  <<<<<
Test> isZero' TZ
True
Test> isZero' (TS TZ)    
(interactive):1:1--1:16:Can't find an implementation for IsZero (TS TZ)
Test> 
Bye for now!

Aparently it is treating the evaluation of isZero as having a hole:

test : Bool
test = isZero (TS TZ)
Test.idr:12:8--13:1:Unsolved holes:
Test.{ok:174} introduced at Test.idr:12:8--13:1
@fabianhjr fabianhjr changed the title NonAuto Implicits get Deferred/Erased Non-Auto Implicits get Deferred/Erased Apr 22, 2020
@fabianhjr fabianhjr changed the title Non-Auto Implicits get Deferred/Erased Non-Auto Implicits get Deferred as Holes Apr 22, 2020
@edwinb
Copy link
Owner

edwinb commented Apr 24, 2020

I suspect this is just that it's not checking whether there are holes left over after checking at the REPL (via checkUserHoles), and given that the missing argument isn't checked or used at all in the definition, it can still successfully evaluate it.

@fabianhjr fabianhjr changed the title Non-Auto Implicits get Deferred as Holes Non-Auto Implicits get Deferred as Holes and not checked on REPL Evaluation Apr 24, 2020
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