Fix checkPossible when unifying bound vars

It's not a rigid fail if it's two bound variables that differ.
Fixes #1108
This commit is contained in:
Edwin Brady 2014-12-20 22:33:33 +00:00
parent 87897174e5
commit 57cd38ae11
5 changed files with 24 additions and 0 deletions

View File

@ -279,6 +279,9 @@ Extra-source-files:
test/reg055/run test/reg055/run
test/reg055/*.idr test/reg055/*.idr
test/reg055/expected test/reg055/expected
test/reg056/run
test/reg056/*.idr
test/reg056/expected
test/basic001/run test/basic001/run
test/basic001/*.idr test/basic001/*.idr

View File

@ -497,6 +497,7 @@ checkPossible info fc tcgen fname lhs_in
ntRec x y | Ref <- x = True ntRec x y | Ref <- x = True
| Ref <- y = True | Ref <- y = True
| (Bound, Bound) <- (x, y) = True
| otherwise = False -- name is different, unrecoverable | otherwise = False -- name is different, unrecoverable
propagateParams :: IState -> [Name] -> Type -> PTerm -> PTerm propagateParams :: IState -> [Name] -> Type -> PTerm -> PTerm

2
test/reg056/expected Normal file
View File

@ -0,0 +1,2 @@
reg056.idr:7:7:dodgy n m Refl is a valid case
reg056.idr:10:6:nonk Refl is a valid case

15
test/reg056/reg056.idr Normal file
View File

@ -0,0 +1,15 @@
k : (a : Type) -> (x, y : a) -> (p, q : x = y) -> p = q
k a x x Refl Refl = Refl
postulate trap : Z = Z
dodgy : (a, b : ()) -> a = b -> Void
dodgy n m Refl impossible
nonk : (trap = Refl {Z}) -> Void
nonk Refl impossible
false : Void
false = nonk (k Nat Z Z trap Refl)

3
test/reg056/run Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
idris $@ reg056.idr -o reg056
rm -f *.ibc