| 1 |
Record test := build { field : nat }. |
| 2 |
Record test_r := build_r { field_r : nat }. |
| 3 |
Record test_c := build_c { field_c : nat }. |
| 4 |
|
| 5 |
Add Printing Constructor test_c. |
| 6 |
Add Printing Record test_r. |
| 7 |
|
| 8 |
Set Printing Records. |
| 9 |
|
| 10 |
Check build 5. |
| 11 |
Check {| field := 5 |}. |
| 12 |
|
| 13 |
Check build_r 5. |
| 14 |
Check build_c 5. |
| 15 |
|
| 16 |
Unset Printing Records. |
| 17 |
|
| 18 |
Check build 5. |
| 19 |
Check {| field := 5 |}. |
| 20 |
Check build_r 5. |
| 21 |
Check build_c 5. |
| 22 |
|
| 23 |
Set Printing Records. |
| 24 |
|
| 25 |
Record N := C { T : Type; _ : True }. |
| 26 |
Check fun x:N => let 'C _ p := x in p. |
| 27 |
Check fun x:N => let 'C T _ := x in T. |
| 28 |
Check fun x:N => let 'C T p := x in (T,p). |
| 29 |
|
| 30 |
Record M := D { U : Type; a := 0; q : True }. |
| 31 |
Check fun x:M => let 'D T _ p := x in p. |
| 32 |
Check fun x:M => let 'D T _ p := x in T. |
| 33 |
Check fun x:M => let 'D T p := x in (T,p). |
| 34 |
Check fun x:M => let 'D T a p := x in (T,p,a). |
| 35 |
Check fun x:M => let '{|U:=T;a:=a;q:=p|} := x in (T,p,a). |
| 36 |
|
| 37 |
Module FormattingIssue13142. |
| 38 |
|
| 39 |
Record T {A B} := {a:A;b:B}. |
| 40 |
|
| 41 |
Module LongModuleName. |
| 42 |
Record test := { long_field_name0 : nat; |
| 43 |
long_field_name1 : nat; |
| 44 |
long_field_name2 : nat; |
| 45 |
long_field_name3 : nat }. |
| 46 |
End LongModuleName. |
| 47 |
|
| 48 |
Definition c := |
| 49 |
{| LongModuleName.long_field_name0 := 0; |
| 50 |
LongModuleName.long_field_name1 := 1; |
| 51 |
LongModuleName.long_field_name2 := 2; |
| 52 |
LongModuleName.long_field_name3 := 3 |}. |
| 53 |
|
| 54 |
Definition d := |
| 55 |
fun '{| LongModuleName.long_field_name0 := a; |
| 56 |
LongModuleName.long_field_name1 := b; |
| 57 |
LongModuleName.long_field_name2 := c; |
| 58 |
LongModuleName.long_field_name3 := d |} => (a,b,c,d). |
| 59 |
|
| 60 |
Check {|a:=0;b:=0|}. |
| 61 |
Check fun '{| LongModuleName.long_field_name0:=_ |} => 0. |
| 62 |
Eval compute in {|a:=c;b:=d|}. |
| 63 |
Import LongModuleName. |
| 64 |
Eval compute in {|a:=c;b:=d|}. |
| 65 |
|
| 66 |
End FormattingIssue13142. |
| 67 |
|
| 68 |
Module ProjectionPrinting. |
| 69 |
|
| 70 |
Notation "a +++ b" := (a * b) (at level 40, format "'[v' a '/' +++ '/' b ']'"). |
| 71 |
|
| 72 |
Record R := { field : nat -> nat }. |
| 73 |
Set Printing Projections. |
| 74 |
Check fun x => 0 +++ x.(field) 0. |
| 75 |
|
| 76 |
End ProjectionPrinting. |
| 77 |
|
| 78 |
Module RecordImplicitParameters. |
| 79 |
|
| 80 |
(* Check that implicit parameters are treated independently of extra |
| 81 |
implicit arguments (at some time they did not and it was failing at |
| 82 |
typing time) *) |
| 83 |
|
| 84 |
Record R A := { f : A -> A }. |
| 85 |
Fail Check fun x => x.(f). |
| 86 |
|
| 87 |
End RecordImplicitParameters. |
| 88 |
|
| 89 |
Module WhyNotPrim. |
| 90 |
|
| 91 |
Set Primitive Projections. |
| 92 |
|
| 93 |
Record squashed : Prop := { x : nat }. |
| 94 |
|
| 95 |
Record noprojs := { y := 0 }. |
| 96 |
|
| 97 |
Record norelevantprojs (A:SProp) := { z : A }. |
| 98 |
|
| 99 |
About norelevantprojs. |
| 100 |
|
| 101 |
Record anonproj := { _ : nat }. |
| 102 |
|
| 103 |
End WhyNotPrim. |