-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ fix ] Fix search around
%defaulthints
(#3258)
* [ cleanup ] Move repeating trying-with-unambiguity pattern to a function * [ fix #2850 ] Search for dependencies for default hints among all hints * [ fix #2932 ] Always try defaults in dependencies search
- Loading branch information
Showing
7 changed files
with
146 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
tests/idris2/interface/interface031/DefaulthintWithDep.idr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
interface X where | ||
x : Nat | ||
|
||
f : X => Nat | ||
f = x + 1 | ||
|
||
namespace NoHintArg | ||
|
||
%defaulthint | ||
DefaultX : X | ||
DefaultX = D where | ||
[D] X where x = 5 | ||
|
||
fDef : Nat | ||
fDef = f | ||
|
||
namespace WithDefaultHintArg | ||
|
||
interface Y' where | ||
y : Nat | ||
|
||
[YY] Y' where | ||
y = 6 | ||
|
||
%defaulthint | ||
YY' : Y' | ||
YY' = YY | ||
|
||
%defaulthint | ||
DefaultX : Y' => X | ||
DefaultX = D where | ||
[D] X where x = 5 | ||
|
||
fDef : Nat | ||
fDef = f | ||
|
||
namespace JustHint | ||
|
||
interface Y'' where | ||
y : Nat | ||
|
||
Y'' where | ||
y = 6 | ||
|
||
%hint | ||
DefaultX : Y'' => X | ||
DefaultX = D where | ||
[D] X where x = 5 | ||
|
||
fDef : Nat | ||
fDef = f | ||
|
||
namespace WithHintArg | ||
|
||
interface Y''' where | ||
y : Nat | ||
|
||
Y''' where | ||
y = 6 | ||
|
||
%defaulthint | ||
DefaultX : Y''' => X | ||
DefaultX = D where | ||
[D] X where x = 5 | ||
|
||
fDef : Nat | ||
fDef = f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1/1: Building DefaulthintWithDep (DefaulthintWithDep.idr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
. ../../../testutils.sh | ||
|
||
check DefaulthintWithDep.idr |
42 changes: 42 additions & 0 deletions
42
tests/idris2/interface/interface032/DefaulthintInterfaceBug.idr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace Data | ||
|
||
interface X where | ||
x : Nat | ||
|
||
data Y : Type where | ||
MkY : Nat -> Y | ||
|
||
Y => X where | ||
x @{MkY y} = y | ||
|
||
%defaulthint | ||
DefY : Y | ||
DefY = MkY 6 | ||
|
||
f : X => IO () | ||
f = printLn x | ||
|
||
main : IO () | ||
main = f | ||
|
||
namespace Interface | ||
|
||
interface X' where | ||
x' : Nat | ||
|
||
interface Y' where | ||
constructor MkY | ||
y' : Nat | ||
|
||
Y' => X' where | ||
x' = y' | ||
|
||
%defaulthint | ||
DefY' : Y' | ||
DefY' = MkY 6 | ||
|
||
f' : X' => IO () | ||
f' = printLn x' | ||
|
||
main : IO () | ||
main = f' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1/1: Building DefaulthintInterfaceBug (DefaulthintInterfaceBug.idr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
. ../../../testutils.sh | ||
|
||
check DefaulthintInterfaceBug.idr |