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

fix: union with parsedModules #2311

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jeshecdom
Copy link
Contributor

@jeshecdom jeshecdom commented Mar 6, 2025

Issue

Closes #2310.

Checklist

  • I have updated CHANGELOG.md
  • I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases

@jeshecdom jeshecdom marked this pull request as ready for review March 6, 2025 13:05
@jeshecdom jeshecdom requested a review from a team as a code owner March 6, 2025 13:05
@@ -63,7 +65,11 @@ export function openContext(
parser: Parser,
parsedModules?: A.AstModule[],
): CompilerContext {
const modules = parsedModules ?? parseModules(sources, parser);
const parsedSources = parseModules(sources, parser);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather make parsedModules required, and pass parseModules(sources, parser) in regular build.

// }
// }

function makeModule(): A.AstModule {
Copy link
Contributor

@verytactical verytactical Mar 12, 2025

Choose a reason for hiding this comment

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

It seems like this should be a set of definitions in src/ast/no-src-factory.ts or even a reuse of existing code for this.

It will be extremely tedious to update manually in case AST definitions change. This code should eventually be generated from AST types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I will migrate all the makeX functions into that new factory, because this will be a common problem in all PRs involving testing: each one of them defines their own makeX functions.

Is there an example on how to generate code for the makeX functions just from the AST types? Do you mean like a pre-compilation step, similar to yarn gen so that all makeX functions are generated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, there was a AstUtil factory. I think I'll place the makeX functions there.

Copy link
Contributor

@verytactical verytactical left a comment

Choose a reason for hiding this comment

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

^

@verytactical verytactical changed the title fix: Union with parsedModules fix: union with parsedModules Mar 12, 2025
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.

Compiling ASTs with references to stdlib causes errors during resolveDescriptors
2 participants