diff options
| author | James Helferty (NVIDIA) <jhelferty@nvidia.com> | 2025-06-14 01:15:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-13 22:15:52 -0700 |
| commit | 6e570b589f61d126fec6062b4ebdce232cd32810 (patch) | |
| tree | a6fd27f1145fa98bcee27864f4284625797e1bdd /tests/bugs | |
| parent | 6a23949f07f4eba38086b656e7073ce3bf8cd2fe (diff) | |
Skip processing import declarations after errors (#7393)
* Add test case for missing import attribution
Add a test case that imports a non-existent file, followed by a valid
file. Tests for absence of a bug where slang reports existent files as
non-existent if they're imported after a non-existent file.
* Skip processing imports after errors
Skip processing additional imports after the first error. This
behavior is already observed in Linkage::loadSourceModuleImpl, but
since that happenes after import processing already started, a false
diagnostic gets generated for a missing import.
By hoisting this check out before the import is processed, the
diagnostic message for a missing file is no longer erroneously
generated.
Fixes #6453
* Revert "Skip processing imports after errors"
This reverts commit 6b2fef09782414de4c5e017c4ecb5f2affa0c199.
* Remove early abort of import processing
Partial revert of commit 04f1bad
Reverts an early return in Linkage::loadSourceModuleImpl() whenever any
error diagnostic message has already been generated. This was causing
earlier errors to prevent subsequent imports from succeeding, and was
misattributing them to a missing file.
Fixes #6453
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/missing-import-attribution.slang | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/bugs/missing-import-attribution.slang b/tests/bugs/missing-import-attribution.slang new file mode 100644 index 000000000..8b5568660 --- /dev/null +++ b/tests/bugs/missing-import-attribution.slang @@ -0,0 +1,19 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target hlsl -entry computeMain -stage compute + +import this_file_does_not_exist; + +import empty; + + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=16):out +RWStructuredBuffer<int> outputBuffer; + +// CHECK-NOT: error 1: {{.*}} 'empty.slang' + +[numthreads(4, 4, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int index = dispatchThreadID.x; + outputBuffer[index] = index; +} + |
