forked from coq/coq
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ltac2 #[abstract] attribute for types
Fix coq#18656 Printing of glb_expr is a bit awkward. We don't have access to the type so we don't know when we cross an abstraction barrier. OTOH constructors and projections are not in the environment / nametab so we still print <abstr> in some places. The attribute is disabled for open types as the naive implementation produces not necessarily expected results.
- Loading branch information
1 parent
0f0f505
commit 2670857
Showing
7 changed files
with
277 additions
and
64 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
doc/changelog/06-Ltac2-language/18766-ltac2-abstract-type.rst
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,5 @@ | ||
- **Added:** | ||
:attr:`abstract` for :cmd:`Ltac2 Type` makes it possible to turn types abstract at the end of a module | ||
(`#18766 <https://github.com/coq/coq/pull/18766>`_, | ||
fixes `#18656 <https://github.com/coq/coq/issues/18656>`_, | ||
by Gaëtan Gilbert). |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
File "./output/ltac2_abstract.v", line 20, characters 27-28: | ||
The command has indeed failed with message: | ||
This expression has type int but an expression was expected of type | ||
M.t | ||
- : M.t = <abstr> | ||
File "./output/ltac2_abstract.v", line 28, characters 27-28: | ||
The command has indeed failed with message: | ||
This expression has type int but an expression was expected of type | ||
t | ||
- : int = 2 | ||
Ltac2 foo : t -> t | ||
foo := fun x => Int.add x 1 | ||
Ltac2 three : t | ||
three := 3 | ||
- : t = <abstr> | ||
File "./output/ltac2_abstract.v", line 47, characters 18-21: | ||
The command has indeed failed with message: | ||
Unbound constructor M.A | ||
File "./output/ltac2_abstract.v", line 49, characters 40-43: | ||
The command has indeed failed with message: | ||
Unbound constructor M.A | ||
- : M.t = <abstr> | ||
- : bool = false | ||
Ltac2 M.a : M.t | ||
M.a := <abstr> | ||
Ltac2 M.is_b : M.t -> bool | ||
M.is_b := fun x => match x with | ||
<abstr> | ||
end | ||
Ltac2 M.get_b : int -> M.t -> int | ||
M.get_b := fun def x => match x with | ||
| <abstr> => x | ||
| _ => def | ||
end | ||
- : int M.t = <abstr> | ||
File "./output/ltac2_abstract.v", line 73, characters 20-21: | ||
The command has indeed failed with message: | ||
p is not a projection | ||
File "./output/ltac2_abstract.v", line 75, characters 30-31: | ||
The command has indeed failed with message: | ||
p is not a projection | ||
- : int t = <abstr> | ||
- : int = 42 | ||
File "./output/ltac2_abstract.v", line 81, characters 27-40: | ||
The command has indeed failed with message: | ||
This expression has type bool but an expression was expected of type | ||
int | ||
Ltac2 make : 'a -> 'a t | ||
make := fun x => <abstr> | ||
Ltac2 p : 'a t -> 'a | ||
p := fun x => <abstr> | ||
Ltac2 set : 'a t -> 'a -> unit | ||
set := fun x v => <abstr> | ||
File "./output/ltac2_abstract.v", line 91, characters 32-33: | ||
The command has indeed failed with message: | ||
Open types currently do not support #[abstract]. |
Oops, something went wrong.