Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move documentation into documented AST node #11302

Closed
6 tasks done
Tracked by #11240 ...
kazcw opened this issue Oct 10, 2024 · 12 comments · Fixed by #11441
Closed
6 tasks done
Tracked by #11240 ...

Move documentation into documented AST node #11302

kazcw opened this issue Oct 10, 2024 · 12 comments · Fixed by #11441

Comments

@kazcw
Copy link
Contributor

kazcw commented Oct 10, 2024

Eliminate Ast.Documented; add a documentation field to documentable syntax nodes (method definition, assignment, type definition, constructor definition, case-of branch). Introduce a node type for "free documentation" that couldn't be attached to anything.

This will enable better warnings: Currently, documentation can be attached to any line; however, documentation attached to some expression types is never used. By explicitly attaching documentation only to syntactic constructs that accept it, we can emit a warning when documentation occurs elsewhere.

This will simplify edits in the frontend: Currently adding or removing documentation changes the AST structurally. This particularly complicates switching to Y.Text-based documentation synchronization.

Tasks

Preview Give feedback
  1. CI: Clean build required CI: No changelog needed CI: Ready to merge
    kazcw
  2. CI: No changelog needed CI: Ready to merge
    kazcw
  3. -parser
    kazcw
  4. CI: No changelog needed CI: Ready to merge
    kazcw
  5. CI: Ready to merge
    kazcw
  6. CI: No changelog needed CI: Ready to merge
    kazcw
@enso-bot
Copy link

enso-bot bot commented Oct 16, 2024

Keziah Wesley reports a new STANDUP for yesterday (2024-10-15):

Progress: Debugging backend tests. Started working on private keyword while waiting for backend to compile. It should be finished by 2024-10-19.

Next Day: Next day I will be working on the #11302 task. Finish changes for private keyword.

@enso-bot
Copy link

enso-bot bot commented Oct 16, 2024

Keziah Wesley reports a new STANDUP for today (2024-10-16):

Progress: Replaced private modifier-node with field. It should be finished by 2024-10-19.

Next Day: Next day I will be working on the #11302 task. Move TypeSignature into Function.

@enso-bot
Copy link

enso-bot bot commented Oct 17, 2024

Keziah Wesley reports a new STANDUP for today (2024-10-17):

Progress: Moved TypeSignature into Function field in parser and parser tests. It should be finished by 2024-10-19.

Next Day: Next day I will be working on the #11302 task. Updating backend tests.

mergify bot pushed a commit that referenced this issue Oct 18, 2024
Align `Assignment`/`Function` distinction in AST with compiler's implemented semantics:
- The ambiguous case `funcOrVar = expression` is now parsed as a `Function` when in a `Type` definition or in the top level of a module. I.e. it is an `Assignment` in contexts where the RHS is evaluated immediately when the binding is evaluated, and a `Function` in contexts where the RHS is evaluated each time the bound name is evaluated.
- `Assignment` statements now may only occur in function bodies.

Correcting this distinction lays the groundwork for #11302.

Other changes:
- Fixed incorrect source code locations for negative literals and negated expressions.

# Important Notes
New APIs:
- The parser now exposes a `parse_block` entry point, which allows parsing input lines as if in the body of a function. The previous entry point has been renamed to `parse_module`.
@enso-bot
Copy link

enso-bot bot commented Oct 22, 2024

Keziah Wesley reports a new STANDUP for the last Friday (2024-10-18):

Progress: Finished TypeSignature changes. It should be finished by 2024-10-19.

Next Day: Next day I will be working on the #11302 task. Start on annotations.

@enso-bot
Copy link

enso-bot bot commented Oct 22, 2024

Keziah Wesley reports a new STANDUP for today (2024-10-21):

Progress: Implemented annotations changes. It should be finished by 2024-10-25.

Next Day: Next day I will be working on the #11302 task. Moving doc comments into field.

@enso-bot
Copy link

enso-bot bot commented Oct 22, 2024

Keziah Wesley reports a new STANDUP for today (2024-10-22):

Progress: Moving doc comments into field of supporting types. It should be finished by 2024-10-25.

Next Day: Next day I will be working on the #11302 task. Finish doc-comment changes.

@enso-bot
Copy link

enso-bot bot commented Oct 25, 2024

Keziah Wesley reports a new STANDUP for yesterday (2024-10-23):

Progress: Removing innerExpression/wrappingExpression logic; adding Statement/Expression distinction. It should be finished by 2024-10-25.

Next Day: Next day I will be working on the #11302 task. Finish doc-comment changes.

@enso-bot
Copy link

enso-bot bot commented Oct 25, 2024

Keziah Wesley reports a new STANDUP for today (2024-10-24):

Progress: Refactored node collapsing for testability; using new statements to simplify block printing. It should be finished by 2024-10-25.

Next Day: Next day I will be working on the #11302 task. Finish doc-comment changes.

@enso-bot
Copy link

enso-bot bot commented Oct 29, 2024

Keziah Wesley reports a new STANDUP for the last Friday (2024-10-25):

Progress: Simplifying printing logic. It should be finished by 2024-10-30.

Next Day: Next day I will be working on the #11302 task. Finish printing changes.

kazcw added a commit that referenced this issue Oct 29, 2024
GUI:
- Distinguish expression and statement
  - `Ast.Ast` is still present, as the base class for AST objects. Most
    references to `Ast.Ast` are now references to `Ast.Expression`. Operations
    on blocks use `Ast.Statement`.
  - `Ast.parse` has been replaced with: `Ast.parseExpression`,
    `Ast.parseStatement`, and `Ast.parseBlock`
  - `syncToCode` is internally context-aware; it parses the provided code
    appropriately depending on whether its AST is an expression, a statement,
    or the top level of a module.
- Remove `wrappingExpression` / `innerExpression` APIs: Wrapper types are no
  longer used; modifier lines are now fields inside parent types.
- Simplify AST printing:
  - Fully implemented autospacing in `concreteChildren` implementations; the
    type returned by `concreteChildren` now ensures that spacing has been fully
    resolved.
  - Eliminate `printBlock` / `printDocs`: `concreteChildren` is now aware of
    indentation context, and responsible for indentation of its child lines.
- The `Pattern` type is now parameterized to identify the AST type it
  constructs. The `Pattern.parseExpression` function helps create a
  `Pattern<Expression>`.
- Refactor `performCollape` for testability.
- e2e tests: Improve table viz test: It still doesn't pass on my Mac, but these
  changes are necessary if not sufficient.

Compiler (TreeToIr):
- An expression in statement context is now found in an `ExpressionStatement`
  wrapper.
- Documentation for a `Function` is now found inside the function node.
- Deduplicate some polyglot-function logic.
@kazcw kazcw linked a pull request Oct 29, 2024 that will close this issue
5 tasks
@enso-bot
Copy link

enso-bot bot commented Oct 30, 2024

Keziah Wesley reports a new STANDUP for yesterday (2024-10-28):

Progress: Finished simplifying printing. Implemented full Expression/Statement type safety. It should be finished by 2024-10-30.

Next Day: Next day I will be working on the #11302 task. Look into issue causes e2e test failures.

@enso-bot
Copy link

enso-bot bot commented Oct 30, 2024

Keziah Wesley reports a new STANDUP for today (2024-10-29):

Progress: Finished the PR. It should be finished by 2024-10-30.

Next Day: Next day I will be working on the #11302 task. Address review, fix merge conflicts, testing. Maybe start integrating new doc panel.

@enso-bot
Copy link

enso-bot bot commented Oct 31, 2024

Keziah Wesley reports a new STANDUP for yesterday (2024-10-30):

Progress: Addressing review, fixing merge conflicts. It should be finished by 2024-10-30.

Next Day: Next day I will be working on the #11302 task. Fix any new merge conflicts, testing. Bringing doc panel PR up to date with develop and docs-fields PR.

mergify bot pushed a commit that referenced this issue Nov 4, 2024
Move documentation into documentable types (implements #11302).

# Important Notes
GUI:
- Distinguish expression and statement
- `Ast.Ast` is still present, as the base class for AST objects. Most references to `Ast.Ast` are now references to `Ast.Expression`. Operations on blocks use `Ast.Statement`.
- `Ast.parse` has been replaced with: `Ast.parseExpression`, `Ast.parseStatement`, and `Ast.parseBlock`
- `syncToCode` is internally context-aware; it parses the provided code appropriately depending on whether its AST is an expression, a statement, or the top level of a module.
- Remove `wrappingExpression` / `innerExpression` APIs: Wrapper types have been eliminated; modifier lines are now fields inside parent types.
- Simplify AST printing:
- Fully implemented autospacing in `concreteChildren` implementations; the type returned by `concreteChildren` now ensures that spacing has been fully resolved.
- Eliminate `printBlock` / `printDocs`: `concreteChildren` is now aware of indentation context, and responsible for indentation of its child lines.
- The `Pattern` type is now parameterized to identify the AST type it constructs. The `Pattern.parseExpression` function helps create a `Pattern<Expression>`.
- Refactor `performCollape` for testability.
- e2e tests: Improve table viz test: It still doesn't pass on my Mac, but these changes are necessary if not sufficient.

Compiler (TreeToIr):
- An expression in statement context is now found in an `ExpressionStatement` wrapper.
- Documentation for a `Function` is now found inside the function node.
- Deduplicate some polyglot-function logic.
@mergify mergify bot closed this as completed in #11441 Nov 4, 2024
@github-project-automation github-project-automation bot moved this from 🔧 Implementation to 🟢 Accepted in Issues Board Nov 4, 2024
@farmaazon farmaazon moved this from 🟢 Accepted to 🗄️ Archived in Issues Board Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🗄️ Archived
Development

Successfully merging a pull request may close this issue.

2 participants