Skip to content

Commit 8c970f1

Browse files
[ fix #3670 ] Instantiate holes with correct PiInfo (#3672)
* [ fix ] Unification error in implementation elaboration * update CHANGELOG_NEXT * [ admin ] Include issue number in changelog text --------- Co-authored-by: Thomas E. Hansen <[email protected]>
1 parent ce0417e commit 8c970f1

File tree

5 files changed

+46
-8
lines changed

5 files changed

+46
-8
lines changed

CHANGELOG_NEXT.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,17 @@ should target this file (`CHANGELOG_NEXT`).
3030
- `Libraries.Data.List.Quantifiers.Extra.tabulate`.
3131
- `Libraries.Utils.Binary.nonEmptyRev`
3232
- `Libraries.Utils.String.dotSep`
33+
* Fixes an issue when unifying labmda terms with implicits (#3670)
34+
* The compiler now warns the user when `impossible` clauses are ignored. This
35+
typically happens when a numeric literal or an ambiguous name appears in an
36+
`impossible` clause.
3337

3438
### Building/Packaging changes
3539

3640
* Fix parsing of capitalised package names containing hyphens.
3741

3842
### Backend changes
3943

40-
### Compiler changes
41-
42-
* The compiler now warns the user when `impossible` clauses are ignored. This
43-
typically happens when a numeric literal or an ambiguous name appears in an
44-
`impossible` clause.
45-
4644
#### RefC Backend
4745

4846
* Fixed an issue to do with `alligned_alloc` not existing on older MacOS

src/Core/Unify.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,9 @@ tryInstantiate {newvars} loc mode env mname mref num mdef locs otm tm
565565
List (Var newvars) ->
566566
IVars vs newvars -> Term newvars -> Term vs ->
567567
Core (Maybe (Term vs))
568-
mkDef (v :: vs) vars soln (Bind bfc x (Pi fc c _ ty) sc)
568+
mkDef (v :: vs) vars soln (Bind bfc x (Pi fc c info ty) sc)
569569
= do sc' <- mkDef vs (ICons (Just v) vars) soln sc
570-
pure $ (Bind bfc x (Lam fc c Explicit (Erased bfc Placeholder)) <$> sc')
570+
pure $ (Bind bfc x (Lam fc c info (Erased bfc Placeholder)) <$> sc')
571571
mkDef vs vars soln (Bind bfc x b@(Let _ c val ty) sc)
572572
= do mbsc' <- mkDef vs (ICons Nothing vars) soln sc
573573
flip traverseOpt mbsc' $ \sc' =>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import Data.Vect
2+
3+
public export
4+
data Chain : (len : Nat) -> (t : Nat -> Type -> Type)
5+
-> (item : Type)
6+
-> (m : forall a, b, c . t a c -> t b c -> Type)
7+
-> (input : t a' item) -> (output : t b' item) -> Type where
8+
Same : {m : forall a, b, c . t a c -> t b c -> Type} -> Chain 0 t item m x x
9+
Apply : {m : forall a, b, c . t a c -> t b c -> Type}
10+
-> (prev : Chain len t item m input intermediate) -> (modification : m intermediate output)
11+
-> Chain (S len) t item m input output
12+
13+
public export
14+
interface LawfulChain (t : Nat -> Type -> Type)
15+
(m : forall a, b, c . t a c -> t b c -> Type) | m where
16+
apply : (input : t len_input item)
17+
-> {0 output : t len_output item} -> (chain : Chain len_chain t item m input output)
18+
-> t len_output item
19+
applyCorrect : (input : t len_input item)
20+
-> {0 output : t len_output item} -> (chain : Chain len_chain t item m input output)
21+
-> (apply input chain) = output
22+
23+
public export
24+
data Modification : Vect n item -> Vect m item -> Type where
25+
Insert : {0 prev : Vect n item} -> (idx : Fin (S n)) -> (it : item)
26+
-> Modification prev (insertAt idx it prev)
27+
Delete : {0 prev : Vect (S n) item} -> (idx : Fin (S n))
28+
-> Modification prev (deleteAt idx prev)
29+
30+
public export
31+
LawfulChain Vect Modification where
32+
apply input Same = input
33+
apply input (Apply prev (Insert idx it)) = insertAt idx it (apply input prev)
34+
apply input (Apply prev (Delete idx)) = deleteAt idx (apply input prev)
35+
applyCorrect input chain = ?applyCorrect_rhs
36+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1/1: Building Issue3670 (Issue3670.idr)

tests/idris2/basic/basic076/run

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
. ../../../testutils.sh
2+
3+
check Issue3670.idr

0 commit comments

Comments
 (0)