Fix at-pattern leak in recursive with blocks (#2834)

This commit is contained in:
Steve Dunham 2022-07-31 15:39:53 -07:00 committed by G. Allais
parent 947432fa30
commit a84a5a32d9
5 changed files with 16 additions and 3 deletions

View File

@ -84,9 +84,9 @@ mutual
= matchAll True [(f, f'), (a, a)] = matchAll True [(f, f'), (a, a)]
-- On RHS: Rely on unification to fill in the implicit -- On RHS: Rely on unification to fill in the implicit
getMatch False (INamedApp fc f n a) f' getMatch False (INamedApp fc f n a) f'
= getMatch False f f = getMatch False f f'
getMatch False (IAutoApp fc f a) f' getMatch False (IAutoApp fc f a) f'
= getMatch False f f = getMatch False f f'
-- Can't have an implicit in the clause if there wasn't a matching -- Can't have an implicit in the clause if there wasn't a matching
-- implicit in the parent -- implicit in the parent
getMatch lhs f (INamedApp fc f' n a) getMatch lhs f (INamedApp fc f' n a)

View File

@ -246,7 +246,7 @@ idrisTestsReflection = MkTestPool "Quotation and Reflection" [] Nothing
idrisTestsWith : TestPool idrisTestsWith : TestPool
idrisTestsWith = MkTestPool "With abstraction" [] Nothing idrisTestsWith = MkTestPool "With abstraction" [] Nothing
[ "with001", "with002", "with004", "with005", "with006", "with007", [ "with001", "with002", "with004", "with005", "with006", "with007",
"with008", "with009", "with010" "with008", "with009", "with010", "with011"
] ]
idrisTestsIPKG : TestPool idrisTestsIPKG : TestPool

View File

@ -0,0 +1,9 @@
import Data.Vect
import Data.Vect.Views.Extra
mergeSort : Ord a => {n : _} -> Vect n a -> Vect n a
mergeSort input with (splitRec input)
mergeSort [] | SplitRecNil = []
mergeSort [x] | SplitRecOne = [x]
mergeSort (xs ++ ys) | (SplitRecPair {xs} {ys} xs_rec ys_rec) =
merge (mergeSort xs | xs_rec) (mergeSort ys | ys_rec)

View File

@ -0,0 +1 @@
1/1: Building WithImplicits (WithImplicits.idr)

3
tests/idris2/with011/run Executable file
View File

@ -0,0 +1,3 @@
rm -rf build
$1 --no-color --console-width 0 --no-banner -p contrib --check WithImplicits.idr