<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/diagnostics/local-used-before-declared.slang, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2019-04-02T13:22:13+00:00</updated>
<entry>
<title>Feature/test improvements (#934)</title>
<updated>2019-04-02T13:22:13+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-04-02T13:22:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=2896aa39a529a00673a30ef4a9c3ebe76f401fea'/>
<id>urn:sha1:2896aa39a529a00673a30ef4a9c3ebe76f401fea</id>
<content type='text'>
* First pass extract the test information by 'running tests'.

* * Checking renderer availablilty
* Using TestInfo to determine which tests are run and synthesized
* Display if test is synthesized and what render api it's targetting

* * Improved comments
* Removed some dead code

* Display ignored tests.

* TestInfo -&gt; TestRequirements

* * Added DIAGNOSTIC_TEST type - test always runs (ie has no requirements).
* Made diagnostic tests use DIAGNOSTIC_TEST
* TestInfo -&gt; TestRequirements
* TestDetails holds TestRequirements and TestOptions

* Fix debug typo.
</content>
</entry>
<entry>
<title>Fix some crashing bugs around local variable declarations. (#385)</title>
<updated>2018-01-26T21:23:16+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2018-01-26T21:23:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=a050f4a144d5ab36c93cd0a443767340301fb32e'/>
<id>urn:sha1:a050f4a144d5ab36c93cd0a443767340301fb32e</id>
<content type='text'>
The basic problem here arises when a local variable is used either before its own declaration:

```hlsl
int a = b;
...
int b = 0;
```

or when a local variable is used *in* its own decalration:

```hlsl
int b = b;
```

In each case, Slang considers the scope of the `{}`-enclosed function body (or nested statement) as a whole, and so the lookup can "see" the declaration even if it is later in the same function.
This behavior isn't really correct for HLSL semantics, so the right long-term fix is to change our scoping rules, but for now users really just want the compiler to not crash on code like this, and give an error message that points at the issue.

This change makes both of the above examples print an error message saying that variable `b` was used before its declaration, which is accurate to the way that Slang is interpreting those code examples.
This is currently treated as a fatal error, so that compilation aborts right away, to avoid all of the downstream crashes that these cases were causing.</content>
</entry>
</feed>
