Fix: Generics decl constraints
This commit is contained in:
@@ -41,3 +41,14 @@ impl TypeExpr {
|
||||
Self(kind, Vec::new())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<GenericDecl> for Generic {
|
||||
fn from(value: GenericDecl) -> Self {
|
||||
match value {
|
||||
GenericDecl::Lifetime(life) => Generic::Lifetime(life),
|
||||
GenericDecl::Type(ty, _) => {
|
||||
Generic::Type(TypeExpr(TypeExprKind::Path(Path(vec![ty])), Vec::new()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for TopLevelKind {
|
||||
ast_expr!(TopLevelKind::ImplDecl(pair.try_into()))
|
||||
}
|
||||
|
||||
Rule::trait_decl => dbg!(ast_expr!(TopLevelKind::TraitDecl {
|
||||
Rule::trait_decl => ast_expr!(TopLevelKind::TraitDecl {
|
||||
visibility: Visibility::try_from(&mut inner),
|
||||
|
||||
name: inner.next().unwrap().try_into(),
|
||||
@@ -117,7 +117,7 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for TopLevelKind {
|
||||
.map(|v| v.unwrap_or_default()),
|
||||
|
||||
items: Ok(Vec::new()) as AstResult<'_, Vec<_>>,
|
||||
})),
|
||||
}),
|
||||
|
||||
_ => AstError::bug_unimplemented(pair),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user