Skip to content

Commit f859994

Browse files
committed
fix: impl for type
1 parent 0a70e15 commit f859994

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

corpus/declarations.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ fn foo(#[attr] x: i32, #[attr] x: i64) {}
8989

9090
fn accumulate(self) -> Machine<{State::Accumulate}> {}
9191

92+
fn foo(bar: impl for<'a> Baz<Quux<'a>>) {}
93+
9294
--------------------------------------------------------------------------------
9395

9496
(source_file
@@ -200,6 +202,24 @@ fn accumulate(self) -> Machine<{State::Accumulate}> {}
200202
(scoped_identifier
201203
path: (identifier)
202204
name: (identifier)))))
205+
body: (block))
206+
(function_item
207+
name: (identifier)
208+
parameters: (parameters
209+
(parameter
210+
pattern: (identifier)
211+
type: (abstract_type
212+
(type_parameters
213+
(lifetime
214+
(identifier)))
215+
trait: (generic_type
216+
type: (type_identifier)
217+
type_arguments: (type_arguments
218+
(generic_type
219+
type: (type_identifier)
220+
type_arguments: (type_arguments
221+
(lifetime
222+
(identifier)))))))))
203223
body: (block)))
204224

205225
================================================================================

grammar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ module.exports = grammar({
809809

810810
abstract_type: $ => seq(
811811
'impl',
812+
optional(seq('for', $.type_parameters)),
812813
field('trait', choice(
813814
$._type_identifier,
814815
$.scoped_type_identifier,

0 commit comments

Comments
 (0)