File tree Expand file tree Collapse file tree 1 file changed +90
-6
lines changed
crates/formality-rust/src Expand file tree Collapse file tree 1 file changed +90
-6
lines changed Original file line number Diff line number Diff line change 1
1
#![ cfg( test) ]
2
- #![ cfg( FIXME ) ]
3
2
4
3
use formality_macros:: test;
5
- use formality_types:: parse :: term;
4
+ use formality_types:: rust :: term;
6
5
7
6
use crate :: grammar:: Program ;
8
7
@@ -20,7 +19,45 @@ fn test_parse_rust_like_trait_impl_syntax() {
20
19
21
20
// Note: the for etc are correctly accounted.
22
21
expect_test:: expect![ [ r#"
23
- [crate core { impl <ty, ty> PartialEq < ^ty0_0 > for ^ty0_1 { } }]
22
+ Program {
23
+ crates: [
24
+ Crate {
25
+ id: core,
26
+ items: [
27
+ TraitImpl(
28
+ TraitImpl {
29
+ safety: Safe,
30
+ binder: Binder {
31
+ kinds: [
32
+ Ty,
33
+ Ty,
34
+ ],
35
+ term: TraitImplBoundData {
36
+ trait_id: PartialEq,
37
+ self_ty: Ty {
38
+ data: Variable(
39
+ ^ty0_1,
40
+ ),
41
+ },
42
+ trait_parameters: [
43
+ Ty(
44
+ Ty {
45
+ data: Variable(
46
+ ^ty0_0,
47
+ ),
48
+ },
49
+ ),
50
+ ],
51
+ where_clauses: [],
52
+ impl_items: [],
53
+ },
54
+ },
55
+ },
56
+ ),
57
+ ],
58
+ },
59
+ ],
60
+ }
24
61
"# ] ]
25
62
. assert_debug_eq ( & r) ;
26
63
}
@@ -39,7 +76,22 @@ fn test_parse_rust_like_trait_syntax() {
39
76
40
77
// Note: two type parameters, and the 0th one is self:
41
78
expect_test:: expect![ [ r#"
42
- [crate core { trait Foo <ty, ty> where ^ty0_1 : Bar < ^ty0_0 > { } }]
79
+ Program {
80
+ crates: [
81
+ Crate {
82
+ id: core,
83
+ items: [
84
+ Trait(
85
+ Trait {
86
+ safety: Safe,
87
+ id: Foo,
88
+ binder: <ty, ty> where ^ty0_1 : Bar <^ty0_0> { },
89
+ },
90
+ ),
91
+ ],
92
+ },
93
+ ],
94
+ }
43
95
"# ] ]
44
96
. assert_debug_eq ( & r) ;
45
97
}
@@ -56,9 +108,41 @@ fn test_parse_rust_like_struct_syntax() {
56
108
]" ,
57
109
) ;
58
110
59
- // Note: two type parameters, and the 0th one is self:
60
111
expect_test:: expect![ [ r#"
61
- [crate core { struct Foo <ty> { a : ^ty0_0 } }]
112
+ Program {
113
+ crates: [
114
+ Crate {
115
+ id: core,
116
+ items: [
117
+ Struct(
118
+ Struct {
119
+ id: Foo,
120
+ binder: Binder {
121
+ kinds: [
122
+ Ty,
123
+ ],
124
+ term: StructBoundData {
125
+ where_clauses: [],
126
+ fields: [
127
+ Field {
128
+ name: Id(
129
+ a,
130
+ ),
131
+ ty: Ty {
132
+ data: Variable(
133
+ ^ty0_0,
134
+ ),
135
+ },
136
+ },
137
+ ],
138
+ },
139
+ },
140
+ },
141
+ ),
142
+ ],
143
+ },
144
+ ],
145
+ }
62
146
"# ] ]
63
147
. assert_debug_eq ( & r) ;
64
148
}
You can’t perform that action at this time.
0 commit comments