File tree Expand file tree Collapse file tree
ide-db/src/syntax_helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,6 +182,15 @@ fn foo<
182182 ) ;
183183 }
184184
185+ #[ test]
186+ fn replace_impl_question_bounds ( ) {
187+ check_assist (
188+ introduce_named_type_parameter,
189+ r#"fn foo(bar: &$0impl ?Sized) {}"# ,
190+ r#"fn foo<$0S: ?Sized>(bar: &S) {}"# ,
191+ ) ;
192+ }
193+
185194 #[ test]
186195 fn replace_impl_with_mut ( ) {
187196 check_assist (
Original file line number Diff line number Diff line change @@ -193,7 +193,10 @@ impl NameGenerator {
193193 pub fn for_impl_trait_as_generic ( & mut self , ty : & ast:: ImplTraitType ) -> SmolStr {
194194 let c = ty
195195 . type_bound_list ( )
196- . and_then ( |bounds| bounds. syntax ( ) . text ( ) . char_at ( 0 . into ( ) ) )
196+ . and_then ( |bounds| {
197+ let ty = bounds. bounds ( ) . next ( ) ?. ty ( ) ?;
198+ ty. syntax ( ) . text ( ) . char_at ( 0 . into ( ) ) . filter ( |ch| ch. is_alphabetic ( ) )
199+ } )
197200 . unwrap_or ( 'T' ) ;
198201
199202 self . suggest_name ( & c. to_string ( ) )
You can’t perform that action at this time.
0 commit comments