<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/bugs/enum-init-cast.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-01-15T21:15:09+00:00</updated>
<entry>
<title>Fix up declaration checking order for enums (#774)</title>
<updated>2019-01-15T21:15:09+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2019-01-15T21:15:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=29ffac963e9c4b02d3cbc9d4b281512ed820e67d'/>
<id>urn:sha1:29ffac963e9c4b02d3cbc9d4b281512ed820e67d</id>
<content type='text'>
The logic in `check.cpp` for declaration checking is very messy and needs to be re-written, but in the interim we need to be careful to avoid any cases where a declaration, or some piece of it, gets redundantly checked multiple times.

The way the logic had been working, the different "cases" in an `enum` type were being checked twice, and that meant that any initialization expression for a case would be type-checked the first time (potentially leading to a new AST) and then the checked AST would be checked again. This created a problem if the first round of checking introduced any AST nodes that the checking logic would not expect to see (because the parser cannot possibly produce them).

The fix here is to follow the style of the other declaration checking cases, where checking is separated into two distinct phases (the "header" phase makes the declaration usable by others, while the "body" phase checks its implementation details for internal consistency).

This change includes a test case that produced an internal compiler error before, and compiles without error now.</content>
</entry>
</feed>
