Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle the mismatching "mutating" signature for implementing interfaces #4467

Closed
jkwak-work opened this issue Jun 24, 2024 · 1 comment · Fixed by #4982
Closed
Assignees
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should

Comments

@jkwak-work
Copy link
Collaborator

Problem description
When the interface declares a function with [mutating], the implementation also has to have [mutating].
If the implementation didn't have the keyword, Slang crashes with an internal error.

Goal
We should print a proper error for the mistake.
Or it should work even when the implementation didn't have the matching [mutating] keyword.

Repro steps
The following code can reproduce the issue.

//TEST:SIMPLE:
//TEST:SIMPLE:-DWITH_MUTATING
interface IHitInfo
{
};

interface IClosestHitQuery
{
    [mutating] void traceRay(out IHitInfo hit);
};

struct GeneratePathClosestHitQuery : IClosestHitQuery
{
#if defined(WITH_MUTATING)
    [mutating]
#endif
    void traceRay(out IHitInfo hit)
    {
        hit = {};
    }
};

Note that the modifier out is required to reproduce the issue.

@tomas-davidovic
Copy link

Also, note that this only crashes when the out parameter is itself an interface. Normal types (pods and structs) work.

@ArielG-NV ArielG-NV added kind:bug something doesn't work like it should goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang labels Jun 25, 2024
@csyonghe csyonghe self-assigned this Sep 2, 2024
@csyonghe csyonghe added this to the Q3 2024 (Summer) milestone Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants