Skip to content

Commit

Permalink
Merge pull request #3314 from dunhamsteve/issue-3313
Browse files Browse the repository at this point in the history
[ fix ] auto search returns no solution instead of ambiguous solution #3313
  • Loading branch information
andrevidela authored Jun 17, 2024
2 parents e9dfc1c + 1807cdc commit 02e5468
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Core/AutoSearch.idr
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ anyOne fc env top [elab]
= catch elab $
\case
err@(CantSolveGoal _ _ _ _ _) => throw err
err@(AmbiguousSearch _ _ _ _) => throw err
_ => throw $ CantSolveGoal fc (gamma !(get Ctxt)) [] top Nothing
anyOne fc env top (elab :: elabs)
= tryUnify elab (anyOne fc env top elabs)
Expand Down
5 changes: 5 additions & 0 deletions tests/idris2/error/error028/Issue3313.idr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data Expr : Type -> Type where
Add : (Integral n) => n -> n -> Expr n

eval : (Integral n) => Expr n -> n
eval (Add x y) = x + y
15 changes: 15 additions & 0 deletions tests/idris2/error/error028/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1/1: Building Issue3313 (Issue3313.idr)
Error: While processing right hand side of eval. Multiple solutions found in search of:
Integral n

Issue3313:5:18--5:23
1 | data Expr : Type -> Type where
2 | Add : (Integral n) => n -> n -> Expr n
3 |
4 | eval : (Integral n) => Expr n -> n
5 | eval (Add x y) = x + y
^^^^^

Possible correct results:
conArg (implicitly bound at Issue3313:5:1--5:23)
conArg (implicitly bound at Issue3313:5:1--5:23)
3 changes: 3 additions & 0 deletions tests/idris2/error/error028/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
. ../../../testutils.sh

check Issue3313.idr

0 comments on commit 02e5468

Please sign in to comment.