-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[naga wgsl-in] Do not attempt automatic type conversion for non-abstr…
…act types Attempting to convert a non-abstract type will always fail, which can result in unrelated errors being misreported as type conversion errors. For example, in #7035 we made it so that abstract types can be used as return values. This changed the final testcase in the invalid_functions() test to fail due to failing to convert a u32 to an atomic<u32>, rather than with a NonConstructibleReturnType error. This patch makes it so that we do not attempt to convert non-abstract types in the first place. This avoids the AutoConversion error for that testcase, meaning the NonConstructibleReturnType is once again reported. Various callsites of try_automatic_conversions() have been updated to ensure they still return an InitializationTypeMismatch error if the types are mismatched, even if try_automatic_conversions() succeeds (eg when conversion was not attempted due to the type being concrete). To reduce code duplication these callsites were all adapted to use the existing type_and_init() helper function. Lastly, a couple of tests that expected to result in a AutoConversion error have been adjusted to ensure this still occurs, by ensuring the type used is abstract.
- Loading branch information
1 parent
a546e60
commit b477c66
Showing
4 changed files
with
61 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters