mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Compute annotation instead of NoTypeAnn in docs code
This commit is contained in:
parent
81bbf57d4c
commit
d7b347bd1d
2 changed files with 5 additions and 4 deletions
|
@ -165,13 +165,14 @@ fn generate_entry_doc<'a>(
|
||||||
(new_acc, Some(comments_or_new_lines))
|
(new_acc, Some(comments_or_new_lines))
|
||||||
}
|
}
|
||||||
|
|
||||||
Def::Annotation(loc_pattern, _loc_ann) => match loc_pattern.value {
|
Def::Annotation(loc_pattern, loc_ann) => match loc_pattern.value {
|
||||||
Pattern::Identifier(identifier) => {
|
Pattern::Identifier(identifier) => {
|
||||||
// Check if the definition is exposed
|
// Check if the definition is exposed
|
||||||
if ident_ids.get_id(&identifier.into()).is_some() {
|
if ident_ids.get_id(&identifier.into()).is_some() {
|
||||||
|
let name = identifier.to_string();
|
||||||
let doc_def = DocDef {
|
let doc_def = DocDef {
|
||||||
name: identifier.to_string(),
|
name,
|
||||||
type_annotation: NoTypeAnn,
|
type_annotation: type_to_docs(false, loc_ann.value),
|
||||||
type_vars: Vec::new(),
|
type_vars: Vec::new(),
|
||||||
docs: before_comments_or_new_lines.and_then(comments_or_new_lines_to_docs),
|
docs: before_comments_or_new_lines.and_then(comments_or_new_lines_to_docs),
|
||||||
};
|
};
|
||||||
|
|
|
@ -624,7 +624,7 @@ fn should_be_multiline(type_ann: &TypeAnnotation) -> bool {
|
||||||
is_multiline
|
is_multiline
|
||||||
}
|
}
|
||||||
TypeAnnotation::Function { args, output } => {
|
TypeAnnotation::Function { args, output } => {
|
||||||
let mut is_multiline = should_be_multiline(output) || args.len() > 1;
|
let mut is_multiline = should_be_multiline(output) || args.len() > 2;
|
||||||
|
|
||||||
for arg in args {
|
for arg in args {
|
||||||
if is_multiline {
|
if is_multiline {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue