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

Don't overwrite existing container decl scopes when parsing new sourc… #6292

Merged

Conversation

aleino-nv
Copy link
Collaborator

…e files.

When a module consists of multiple source files, the module scope gets over-written for each source file that's parsed into the module.
The result is that if you do something like the following, where source1.slang contains an import statement, then the imported module will get imported into the module scope corresponding to source2.slang, but won't be found from the scope of source1.slang.

slangc source1.slang source2.slang # 1 module from 2 source files

This patch fixes this problem by not over-writing existing container decl scope when parsing new source files into the container.

This closes #6221.

@aleino-nv aleino-nv requested a review from a team as a code owner February 5, 2025 12:40
@aleino-nv aleino-nv added the pr: non-breaking PRs without breaking changes label Feb 5, 2025
…iles

When a module consists of multiple source files, the module scope gets over-written for
each source file that's parsed into the module.
The result is that if you do something like the following, where source1.slang contains
an import statement, then the imported module will get imported into the module scope
corresponding to source2.slang, but won't be found from the scope of source1.slang.

slangc source1.slang source2.slang # 1 module from 2 source files

This patch fixes this problem by not over-writing existing container decl scope
when parsing new source files into the container.

This closes $6221.
@aleino-nv aleino-nv force-pushed the aleino/visibility-bug-fix-2 branch from 027885b to b8a8db7 Compare February 5, 2025 13:08
@csyonghe csyonghe closed this Feb 5, 2025
@csyonghe csyonghe reopened this Feb 5, 2025
@aleino-nv aleino-nv enabled auto-merge (squash) February 6, 2025 07:36
@aleino-nv aleino-nv merged commit 075b10e into shader-slang:master Feb 6, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple source files with module imports only work on the last source file
2 participants