Separating parsing of for in predicates and types

This commit is contained in:
Matthew Jasper 2020-06-10 11:30:48 +01:00
parent 560b98bc50
commit 506e1ddbfa
12 changed files with 507 additions and 291 deletions

View file

@ -285,6 +285,8 @@ where
let pred = predicates.next().unwrap();
let mut bounds = pred.type_bound_list().unwrap().bounds();
assert!(pred.for_token().is_none());
assert!(pred.type_param_list().is_none());
assert_eq!("T", pred.type_ref().unwrap().syntax().text().to_string());
assert_bound("Clone", bounds.next());
assert_bound("Copy", bounds.next());
@ -322,6 +324,8 @@ where
let pred = predicates.next().unwrap();
let mut bounds = pred.type_bound_list().unwrap().bounds();
assert_eq!("for<'a> F", pred.type_ref().unwrap().syntax().text().to_string());
assert!(pred.for_token().is_some());
assert_eq!("<'a>", pred.type_param_list().unwrap().syntax().text().to_string());
assert_eq!("F", pred.type_ref().unwrap().syntax().text().to_string());
assert_bound("Fn(&'a str)", bounds.next());
}