<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/bugs/gh-6589.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>2025-04-18T00:58:11+00:00</updated>
<entry>
<title>Fix regression in partial specialization of existential arguments (#6818)</title>
<updated>2025-04-18T00:58:11+00:00</updated>
<author>
<name>kaizhangNV</name>
<email>149626564+kaizhangNV@users.noreply.github.com</email>
</author>
<published>2025-04-18T00:58:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=ee8a91e22813cf962be25e2c9f9263c20b70e228'/>
<id>urn:sha1:ee8a91e22813cf962be25e2c9f9263c20b70e228</id>
<content type='text'>
Close #6589.

In PR #6487, we support partial specialization. However there is a corner case we didn't handle correctly.

For the IR like this:

%val: specialize(...) = some inst;
%arg1: specialize(...) = makeExistential(%val, ...);
%arg2: %SomeConcreteType: load(...);
call func(%arg1, %arg2);

when we specialize the call func instruct, we will also specialize the function parameters.

On our existing logic, when we find an argument is a makeExistential, we will always extract the existential value, and use its type as the new parameter.

But in this case, %arg1 is not fully specialized yet, so it's type will still be a specialize. In this case, we will change the function's first parameter from an existential type to a specialize. This will result in that we lose the chance to specialize the first argument in the next iteration, because the first parameter of this function is not an existential type any more.

The reason behind this is that we should always keep specializing the arguments and parameters at the same time.

So this PR just does a check before specializing the parameters that if the argument cannot be fully specialized, we won't specialize the parameter this early. Instead, we will wait for the next iteration until the argument can be specialized.</content>
</entry>
</feed>
