-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat holes as non-rigid meta-variables during instance search (#3293)
* Closes #3157 * During instance search, the holes are now treated like meta-variables -- they match anything. The holes are not unified during instance search, but on success all dangling meta-variables are replaced by fresh holes which later need to be filled by the type-checker. In rare situations, the type-checker might not be able to fill them even though instance resolution succeeded (then we get the "Unable to infer the hole" error).
- Loading branch information
Showing
8 changed files
with
94 additions
and
51 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
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
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
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
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 |
---|---|---|
|
@@ -14,3 +14,4 @@ abba3 | |
a :: b :: c :: d :: nil | ||
\{ true := false | false := true } | ||
3, 1 :: 2 :: nil | ||
6 |
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
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
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,25 @@ | ||
module InstanceSearchTermination; | ||
|
||
import Stdlib.Prelude open; | ||
|
||
trait | ||
type T1 A B C := mkT1; | ||
|
||
trait | ||
type T2 A B := mkT2; | ||
|
||
trait | ||
type T3 A := mkT3; | ||
|
||
coercion instance | ||
coe1 {A B} {{T2 A B}} : T3 A := mkT3; | ||
|
||
coercion instance | ||
coe2 {A B} {{T1 A A A}} : T2 B A := mkT2; | ||
|
||
instance | ||
inst1 {A} : T1 A (List A) (List A) := mkT1; | ||
|
||
f {A} {{T3 A}} : A -> A := id; | ||
|
||
main : Nat := f 0; |