microsoft / microsoft/DirectXShaderCompiler
Improve error reporting for intrinsic methods with type mismatched arguments
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
In the course of writing tests for the fix to #2693 and #818, I discovered that intrinsic methods have their own error reporting path that fix doesn't resolve.
https://godbolt.org/z/ExYrj31z9
Texture2D<float4> tex;
SamplerComparisonState samp;
float4 main(float2 coord : C) : SV_Target {
return tex.Sample(samp, coord);
}
The reporting attempts to report why both variants don't match, but the reporting for the arg type mismatch is elided due to incomplete error reporting from the HLSL code, so the only error message is for the second version, which takes more arguments, leading to this baffling error:
<source>:5:14: error: no matching member function for call to 'Sample'
return tex.Sample(samp, coord);
~~~~^~~~~~
<source>:5:14: note: candidate function template not viable: requires 3 arguments, but 2 were provided
<source>:5:14: note: candidate function template not viable: requires 4 arguments, but 2 were provided
<source>:5:14: note: candidate function template not viable: requires 5 arguments, but 2 were provided
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the HLSL example from the Godbolt link and compare its diagnostics with the fixes referenced in #2693 and #818. Start by tracing the intrinsic-method error reporting path described in the issue. Done means the mismatched argument type is reported alongside the candidate argument-count notes instead of being omitted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100