mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-19 17:21:59 +03:00
Merge pull request #3306 from dunhamsteve/implicitParam
[ fix ] implicits are not in scope under an implicit parameter block
This commit is contained in:
commit
ddb691bcdc
@ -726,9 +726,10 @@ implicitsAs n defs ns tm
|
||||
Core (List (Name, PiInfo RawImp))
|
||||
-- #834 When we are in a local definition, we have an explicit telescope
|
||||
-- corresponding to the variables bound in the parent function.
|
||||
-- So we first peel off all of the explicit quantifiers corresponding
|
||||
-- to these variables.
|
||||
findImps ns es (_ :: locals) (NBind fc x (Pi _ _ Explicit _) sc)
|
||||
-- Parameter blocks also introduce additional telescope of implicit, auto,
|
||||
-- and explicit variables. So we first peel off all of the quantifiers
|
||||
-- corresponding to these variables.
|
||||
findImps ns es (_ :: locals) (NBind fc x (Pi _ _ _ _) sc)
|
||||
= do body <- sc defs (toClosure defaultOpts [] (Erased fc Placeholder))
|
||||
findImps ns es locals body
|
||||
-- ^ TODO? check that name of the pi matches name of local?
|
||||
|
7
tests/idris2/reg/reg053/ImplicitParam.idr
Normal file
7
tests/idris2/reg/reg053/ImplicitParam.idr
Normal file
@ -0,0 +1,7 @@
|
||||
import Data.Vect
|
||||
|
||||
-- m was not in scope when n is implicit
|
||||
parameters {n : Nat}
|
||||
foo : Vect m Nat -> Nat
|
||||
foo xs = ?hole
|
||||
|
4
tests/idris2/reg/reg053/Issue2444.idr
Normal file
4
tests/idris2/reg/reg053/Issue2444.idr
Normal file
@ -0,0 +1,4 @@
|
||||
parameters {0 res : Type}
|
||||
fun : {x : Nat} -> Nat
|
||||
fun = x
|
||||
|
8
tests/idris2/reg/reg053/expected
Normal file
8
tests/idris2/reg/reg053/expected
Normal file
@ -0,0 +1,8 @@
|
||||
1/1: Building ImplicitParam (ImplicitParam.idr)
|
||||
Main> {n : Nat}
|
||||
0 m : Nat
|
||||
xs : Vect m Nat
|
||||
------------------------------
|
||||
hole : Nat
|
||||
Main> Bye for now!
|
||||
1/1: Building Issue2444 (Issue2444.idr)
|
2
tests/idris2/reg/reg053/input
Normal file
2
tests/idris2/reg/reg053/input
Normal file
@ -0,0 +1,2 @@
|
||||
:ti hole
|
||||
:q
|
3
tests/idris2/reg/reg053/run
Normal file
3
tests/idris2/reg/reg053/run
Normal file
@ -0,0 +1,3 @@
|
||||
. ../../../testutils.sh
|
||||
idris2 ImplicitParam.idr < input
|
||||
check Issue2444.idr
|
Loading…
Reference in New Issue
Block a user