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

Ast.Vector #9328

Merged
merged 3 commits into from
Mar 8, 2024
Merged

Ast.Vector #9328

merged 3 commits into from
Mar 8, 2024

Conversation

kazcw
Copy link
Contributor

@kazcw kazcw commented Mar 7, 2024

Pull Request Description

Add Vector AST type, corresponding to the RawAst.Tree.Array type (name Array not used for obvious reasons).

This is the first step of #5138.

Important Notes

  • Switched some string-based vector construction to Vector.new, improving type-safety.
  • The Ast changes are covered by the round-trip tests; the use-site changes have been tested manually.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@kazcw kazcw added CI: No changelog needed Do not require a changelog entry for this PR. -gui labels Mar 7, 2024
@kazcw kazcw self-assigned this Mar 7, 2024
Comment on lines 53 to 54
: props.input.expectedType?.startsWith('Standard.Base.Data.Vector.Vector') ? Score.Good
: props.input.value instanceof Ast.Vector ? Score.Perfect
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I suggest switching these lines. If we have vector Ast and the expected type is Vector, it should be a perfect match, not Good.

@@ -231,12 +232,27 @@ const yLabelLeft = computed(
)
const yLabelTop = computed(() => -margin.value.left + 15)

function vectorOfNumericLiterals(values: number[]): Ast.Owned | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about moving this to utils? Seems like a useful function.

const escapeString = (str: string): string => {
const escaped = str.replaceAll(/([\\'])/g, '\\$1')
return `'${escaped}'`
function vectorOfTextLiterals(values: string[]): Ast.Owned {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

@kazcw kazcw merged commit 8e437fa into develop Mar 8, 2024
32 of 35 checks passed
@kazcw kazcw deleted the wip/kw/vector-ast branch March 8, 2024 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-gui CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants