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

[DSLX] use syntax: enable using a module. #1924

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cdleary
Copy link
Collaborator

@cdleary cdleary commented Feb 11, 2025

analogous (but more powerful than) import, e.g.

use std;

and

use path::to::my_module;

Then we can colon-ref off of that module name.

The type of a module reference is an existential wrapper of the module identity itself. This lets us keep type information for the AST node in the TypeInfo mapping without having a "hole" where an AST node has no associated type information.

Implementation-wise this mostly means that UseTreeEntry* nodes have to ride the same pathways that Import* nodes were already riding in order to resolve module attributes.

@cdleary cdleary force-pushed the cdleary/2025-02-10-ability-to-use-modules branch 3 times, most recently from ec95343 to 1c69fbc Compare February 11, 2025 19:48
@cdleary cdleary marked this pull request as ready for review February 11, 2025 19:51
@grebe grebe requested a review from richmckeever February 11, 2025 20:52
xls/dslx/frontend/ast.cc Outdated Show resolved Hide resolved
@cdleary cdleary force-pushed the cdleary/2025-02-10-ability-to-use-modules branch 2 times, most recently from 9112d27 to bae2348 Compare February 12, 2025 02:53
Then we can colon-ref off of it.

The type of a module reference is an existential wrapper of the module identity
itself. This lets us keep type information for the AST node in the TypeInfo
mapping without having a "hole" where an AST node has no associated type
information.
@cdleary cdleary force-pushed the cdleary/2025-02-10-ability-to-use-modules branch from bae2348 to 4d83081 Compare February 12, 2025 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants