<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/diagnostics/interfaces/mutating-impl-of-non-mutating-req.slang.expected, 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>2023-11-06T22:40:38+00:00</updated>
<entry>
<title>Fix ICE when lowering an associatedtype declref from an derived interface. (#3312)</title>
<updated>2023-11-06T22:40:38+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2023-11-06T22:40:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=46529df2c4f73a4655bdd79d48004f29374a99a8'/>
<id>urn:sha1:46529df2c4f73a4655bdd79d48004f29374a99a8</id>
<content type='text'>
* Fix ICE when lowering an associatedtype declref from an derived interface.

* Fixes.

* Fix test.

* Fix GLSL/SPIRV image subscript swizzle store regression.

* Fix.

---------

Co-authored-by: Yong He &lt;yhe@nvidia.com&gt;</content>
</entry>
<entry>
<title>Fix erroneous error claiming variable is being used before its declaration (#2958)</title>
<updated>2023-07-06T19:52:00+00:00</updated>
<author>
<name>Ellie Hermaszewska</name>
<email>ellieh@nvidia.com</email>
</author>
<published>2023-07-06T19:52:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=cdfea42f1b28c6ec7b13500a64be823f67bf8e0a'/>
<id>urn:sha1:cdfea42f1b28c6ec7b13500a64be823f67bf8e0a</id>
<content type='text'>
* Simplify type of diagnoseImpl

* Show source line for Note diagnostics, opting out of this where appropriate

* Make declared after use diagnostic clearer

* Fix erroneous error claiming variable is being used before its declaration

Closes https://github.com/shader-slang/slang/issues/2936

* Fix build on msvc

---------

Co-authored-by: jsmall-nvidia &lt;jsmall@nvidia.com&gt;</content>
</entry>
<entry>
<title>A bunch of overlapping semantic-checking fixes (#1743)</title>
<updated>2021-03-10T23:18:06+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2021-03-10T23:18:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=6cbd9d68a03f0a22305d4e224a3da7633b23de38'/>
<id>urn:sha1:6cbd9d68a03f0a22305d4e224a3da7633b23de38</id>
<content type='text'>
This change originally started with the simple goal of allowing generic functions with default argument values on their parameters to work:

```
void someFunction&lt;T&gt;(T value, int optional = 0);
```

The core problem there was that the compiler code was (correctly) anticipate the case where the default argument value for a parameter depends on a generic parameter, such as:

```
interface IDefaultable { static This getDefault(); }

void anotherFunction&lt;T : IDefaultable&gt;(T first, T second = T.getDefault());
```

Supporting this latter case requires some kind of ability to apply subsitutions to an `Expr`, but our compiler logic simply errored out in that case. The first major fix that went into this change was to add a new `SubstExpr&lt;T&gt;` type that behaves a lot like `DeclRef&lt;T&gt;` in that it stores a `T*` plus a set of substititions that need to be applied to it.

In addition, it was found that even if `anotherFunction&lt;ConcreteType&gt;(...)` might work, when generic argument inference was used for just `anotherFunction(...)` would fail because it includes a strict match on the number of arguments/parameters in the call expression.

The next problem that arose was that the test I'd created used an interace with an `__init` requirement, and it appeared that our code generation didn't work for that case:

```
interface IStuff { __init(int val); }

void f&lt;T : IStuff&gt;(T x = T(0));
```

In this case, the `T(0)` initialization would get compiled to `(ConcreteType) 0` in the output rather than calling the function generated for the `__init` inside `ConcreteType`. The basic problem there was a bit of crufty old logic we have in place to work around the large number of `__init` declarations in the stdlib that don't have proper `__intrinsic_op` modifiers on them. We really need to fix the underlying problem there, but I worked around it by having the IR lowering pass only do its workaround magic on stdlib declarations.

The next problem down this line was that my test had two different `__init` declarations in the concrete type and the logic for checking interface conformance was picking the wrong one to satisfying an interface requirement despite it being obviously wrong (not even the right number of parameter).

This last problem led me down the rabbit-hole of trying to actually get our semantic checking for interface requirements right. There were a few pieces to that work:

* Actually checking that the parameter and result types for two callables match is the simple part. If that was all that would be required we would have implement this logic a long time ago.

* Next we have to deal with functions that make use of the `This` type, associated types, etc. We have to know that when the interface uses `This`, we want to treat that as equivalent to `ConcreteType`, and similarly for associated types. Getting that working is mostly a matter of setting up a this-type subsitution for the interface member being checked.

* Finally, when comparing generic declarations like `IBase::doThing&lt;T&gt;` and `Derived::doThing&lt;U&gt;` we need to deal with the way that `T` and `U` represent the "same" logical type parameter, but are distinct `Decl`s. This is handled by specializing the base declaration to the parameters of the derived one (e.g., forming `IBase::doThing&lt;U&gt;` using the `U` from `Derived::doThing`).

The result seems to be passing our tests, but there are still a few gotchas lurking, I'm sure.</content>
</entry>
<entry>
<title>Diagnostic location highlighting (#1700)</title>
<updated>2021-02-12T19:31:56+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2021-02-12T19:31:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=369279e91dde1b056d8d0e3bb83e7ba3f96321af'/>
<id>urn:sha1:369279e91dde1b056d8d0e3bb83e7ba3f96321af</id>
<content type='text'>
* #include an absolute path didn't work - because paths were taken to always be relative.

* WIP: First pass in supporting output of line error information.

* Add support for lexing to better be able to indicate SourceLocation information.

* Fix lexer usage in DiagnosticSink in C++ extractor.

* Update diagnostics tests to have line location info.

* Fixed test expected output that now have source location information in them.

* Better handling of tab.

* Fix test expected results for tabbing change.

* DiagnosticLexer -&gt; DiagnosticSink::SourceLocationLexer
Added line continuation tests.

* Fix typo.

* Added String::appendRepeatedChar

* Change to rerun tests.

Co-authored-by: Tim Foley &lt;tfoleyNV@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Fix bugs related to mutating implementations of interface methods (#1461)</title>
<updated>2020-07-25T01:12:41+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2020-07-25T01:12:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=87940a649e3b4f757905015de95225d57ec2f27c'/>
<id>urn:sha1:87940a649e3b4f757905015de95225d57ec2f27c</id>
<content type='text'>
There are two main bug fixes here:

* We were failing to diagnose when code calls a `[mutating]` method on a value that doesn't support mutation (that is an r-value instead of an l-value).

* We had a bug in the synthesis logic for interface requirements where we used the *result* type of the requirement in place of each of the *parameter* types.

The second bug made synthesis often produce incorrect signatures with `void` parameters.

The first bug meant that even though a `[mutating]` method should not be able to satisfy a non-`[mutating]` method (and we had code to enforce this for the "exact match" case), when we go on to try and synthesize a non-`[mutating]` method that satisfies the requirement by delegating to the user-written one, it would end up succeeding, because nothing was stopping a non-`[mutating]` method from calling a `[mutating]` one.

In each case this code adds a fix and a test case to confirm it.</content>
</entry>
</feed>
