From fc6f7d26136f413a6f21fa8b78b79e4bf52e8e6c Mon Sep 17 00:00:00 2001 From: Ayaz Hafiz Date: Mon, 17 Oct 2022 10:35:24 -0500 Subject: [PATCH] Basic support for multi-ability docs --- crates/compiler/load_internal/src/docs.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/compiler/load_internal/src/docs.rs b/crates/compiler/load_internal/src/docs.rs index 41815f0594..0295fa9c47 100644 --- a/crates/compiler/load_internal/src/docs.rs +++ b/crates/compiler/load_internal/src/docs.rs @@ -86,7 +86,7 @@ pub enum RecordField { pub struct AbilityMember { pub name: String, pub type_annotation: TypeAnnotation, - pub able_variables: Vec<(String, TypeAnnotation)>, + pub able_variables: Vec<(String, Vec)>, pub docs: Option, } @@ -387,7 +387,7 @@ fn type_to_docs(in_func_type_ann: bool, type_annotation: ast::TypeAnnotation) -> fn ability_member_type_to_docs( type_annotation: ast::TypeAnnotation, -) -> (TypeAnnotation, Vec<(String, TypeAnnotation)>) { +) -> (TypeAnnotation, Vec<(String, Vec)>) { match type_annotation { ast::TypeAnnotation::Where(ta, has_clauses) => { let ta = type_to_docs(false, ta.value); @@ -397,8 +397,10 @@ fn ability_member_type_to_docs( let ast::HasClause { var, abilities } = hc.value; ( var.value.extract_spaces().item.to_string(), - // TODO(abilities) - type_to_docs(false, abilities[0].value), + abilities + .iter() + .map(|ability| type_to_docs(false, ability.value)) + .collect(), ) }) .collect();