@@ -50,28 +50,28 @@ fn get_fn_sig(srv: astsrv::srv, fn_id: doc::ast_id) -> option<str> {
50
50
alt check ctxt. ast_map . get ( fn_id) {
51
51
ast_map:: node_item ( @{
52
52
ident: ident,
53
- node: ast:: item_fn ( decl, _ , _) , _
53
+ node: ast:: item_fn ( decl, tys , _) , _
54
54
} , _) |
55
55
ast_map:: node_native_item ( @{
56
56
ident: ident,
57
- node: ast:: native_item_fn ( decl, _ ) , _
57
+ node: ast:: native_item_fn ( decl, tys ) , _
58
58
} , _, _) {
59
- some ( pprust:: fun_to_str ( decl, ident, [ ] ) )
59
+ some ( pprust:: fun_to_str ( decl, ident, tys ) )
60
60
}
61
61
}
62
62
}
63
63
}
64
64
65
65
#[ test]
66
66
fn should_add_fn_sig ( ) {
67
- let doc = test:: mk_doc ( "fn a() -> int { }" ) ;
68
- assert doc. cratemod ( ) . fns ( ) [ 0 ] . sig == some ( "fn a() -> int" ) ;
67
+ let doc = test:: mk_doc ( "fn a<T> () -> int { }" ) ;
68
+ assert doc. cratemod ( ) . fns ( ) [ 0 ] . sig == some ( "fn a<T> () -> int" ) ;
69
69
}
70
70
71
71
#[ test]
72
72
fn should_add_native_fn_sig ( ) {
73
- let doc = test:: mk_doc ( "native mod a { fn a() -> int; }" ) ;
74
- assert doc. cratemod ( ) . nmods ( ) [ 0 ] . fns [ 0 ] . sig == some ( "fn a() -> int" ) ;
73
+ let doc = test:: mk_doc ( "native mod a { fn a<T> () -> int; }" ) ;
74
+ assert doc. cratemod ( ) . nmods ( ) [ 0 ] . fns [ 0 ] . sig == some ( "fn a<T> () -> int" ) ;
75
75
}
76
76
77
77
fn fold_const (
@@ -149,9 +149,9 @@ fn fold_res(
149
149
sig: some ( astsrv:: exec ( srv) { |ctxt|
150
150
alt check ctxt. ast_map . get ( doc. id ( ) ) {
151
151
ast_map:: node_item ( @{
152
- node: ast:: item_res ( decl, _ , _, _, _) , _
152
+ node: ast:: item_res ( decl, tys , _, _, _) , _
153
153
} , _) {
154
- pprust:: res_to_str ( decl, doc. name ( ) , [ ] )
154
+ pprust:: res_to_str ( decl, doc. name ( ) , tys )
155
155
}
156
156
}
157
157
} )
@@ -161,8 +161,9 @@ fn fold_res(
161
161
162
162
#[ test]
163
163
fn should_add_resource_sigs ( ) {
164
- let doc = test:: mk_doc ( "resource r(b: bool) { }" ) ;
165
- assert doc. cratemod ( ) . resources ( ) [ 0 ] . sig == some ( "resource r(b: bool)" ) ;
164
+ let doc = test:: mk_doc ( "resource r<T>(b: bool) { }" ) ;
165
+ assert doc. cratemod ( ) . resources ( ) [ 0 ] . sig
166
+ == some ( "resource r<T>(b: bool)" ) ;
166
167
}
167
168
168
169
fn fold_iface (
@@ -202,7 +203,11 @@ fn get_method_sig(
202
203
method. ident == method_name
203
204
} {
204
205
some ( method) {
205
- some ( pprust:: fun_to_str ( method. decl , method. ident , [ ] ) )
206
+ some ( pprust:: fun_to_str (
207
+ method. decl ,
208
+ method. ident ,
209
+ method. tps
210
+ ) )
206
211
}
207
212
}
208
213
}
@@ -213,7 +218,11 @@ fn get_method_sig(
213
218
method. ident == method_name
214
219
} {
215
220
some ( method) {
216
- some ( pprust:: fun_to_str ( method. decl , method. ident , [ ] ) )
221
+ some ( pprust:: fun_to_str (
222
+ method. decl ,
223
+ method. ident ,
224
+ method. tps
225
+ ) )
217
226
}
218
227
}
219
228
}
@@ -223,8 +232,9 @@ fn get_method_sig(
223
232
224
233
#[ test]
225
234
fn should_add_iface_method_sigs ( ) {
226
- let doc = test:: mk_doc ( "iface i { fn a() -> int; }" ) ;
227
- assert doc. cratemod ( ) . ifaces ( ) [ 0 ] . methods [ 0 ] . sig == some ( "fn a() -> int" ) ;
235
+ let doc = test:: mk_doc ( "iface i { fn a<T>() -> int; }" ) ;
236
+ assert doc. cratemod ( ) . ifaces ( ) [ 0 ] . methods [ 0 ] . sig
237
+ == some ( "fn a<T>() -> int" ) ;
228
238
}
229
239
230
240
fn fold_impl (
@@ -258,7 +268,7 @@ fn fold_impl(
258
268
259
269
#[ test]
260
270
fn should_add_impl_iface_ty ( ) {
261
- let doc = test:: mk_doc ( "impl i of j for int { fn a() { } }" ) ;
271
+ let doc = test:: mk_doc ( "impl i of j for int { fn a<T> () { } }" ) ;
262
272
assert doc. cratemod ( ) . impls ( ) [ 0 ] . iface_ty == some ( "j" ) ;
263
273
}
264
274
@@ -276,8 +286,9 @@ fn should_add_impl_self_ty() {
276
286
277
287
#[ test]
278
288
fn should_add_impl_method_sigs ( ) {
279
- let doc = test:: mk_doc ( "impl i for int { fn a() -> int { fail } }" ) ;
280
- assert doc. cratemod ( ) . impls ( ) [ 0 ] . methods [ 0 ] . sig == some ( "fn a() -> int" ) ;
289
+ let doc = test:: mk_doc ( "impl i for int { fn a<T>() -> int { fail } }" ) ;
290
+ assert doc. cratemod ( ) . impls ( ) [ 0 ] . methods [ 0 ] . sig
291
+ == some ( "fn a<T>() -> int" ) ;
281
292
}
282
293
283
294
fn fold_type (
0 commit comments