Skip to content

@doc and @meta annotations#446

Draft
dmitrii-ubskii wants to merge 3 commits into
typedb:masterfrom
dmitrii-ubskii:doc-annos
Draft

@doc and @meta annotations#446
dmitrii-ubskii wants to merge 3 commits into
typedb:masterfrom
dmitrii-ubskii:doc-annos

Conversation

@dmitrii-ubskii

Copy link
Copy Markdown
Member

Product change and motivation

Implementation

@dmitrii-ubskii dmitrii-ubskii force-pushed the doc-annos branch 3 times, most recently from fc420c4 to 1882f30 Compare May 5, 2026 15:24
let mut children = node.into_children();
let keyword = children.consume_any();
let annotation_category = match keyword.as_rule() {
Rule::ANNOTATION_ABSTRACT => AnnotationCategory::Abstract,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh fun can we dissolve the core-specific IR for these now?

Comment thread rust/parser/typeql.pest
// FUNCTION DEFINITION =========================================================

definition_function = { FUN ~ function_signature ~ COLON ~ function_block }
definition_function = { FUN ~ function_signature ~ annotations? ~ COLON ~ function_block }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so how do we expect to write this?

define
fun get_name($p: person) -> { name}
    @doc("..."):
  match $p has name $name;
  return { $name };

?

write!(f, "{} ", token::Keyword::Fun)?;
Pretty::fmt(&self.signature, indent_level, f)?;
for annotation in &self.annotations {
write!(f, " {}", annotation)?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we put the newline before each annotation with 4 spaces (2 more than a regular indent?)

@flyingsilverfin flyingsilverfin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved w comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants