mirrored from https://skia.googlesource.com/skia
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error reporting for duplicate-definition functions.
Previously, we would err on the side of showing the "other" function instead of showing the user's function. However, when the "other" function is from a module, it can leak a `$genType` or a `$pure` into the error message, which might be confusing for users. Now, we will err on the side of showing the user's function more often. This change also lets `FunctionDefinition::description()` return more accurate results. Previously, we were hiding `sk_has_side_effects`/`$pure` to make error messages look nicer, but that meant that a FunctionDefinition's description() was not round-trip-safe. Change-Id: Ie45568f1ff39b075fdd002481351cddf26c507d1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/584399 Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
- Loading branch information
1 parent
073a990
commit f866291
Showing
7 changed files
with
40 additions
and
37 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
### Compilation failed: | ||
|
||
error: 2: duplicate definition of void func() | ||
error: 2: duplicate definition of 'void func()' | ||
void func() {} | ||
^^^^^^^^^^^ | ||
1 error |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
### Compilation failed: | ||
|
||
error: 4: duplicate definition of $genHType fma($genHType a, $genHType b, $genHType c) | ||
error: 4: duplicate definition of 'half fma(half a, half b, half c)' | ||
half fma(half a, half b, half c) { return 0; /* error: overloads a builtin */ } | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
error: 7: duplicate definition of $genHType sin($genHType angle) | ||
error: 7: duplicate definition of 'half2 sin(half2 a)' | ||
half2 sin(half2 a) { return half2(0); /* error: overloads a builtin */ } | ||
^^^^^^^^^^^^^^^^^^ | ||
error: 8: duplicate definition of $genType sin($genType angle) | ||
error: 8: duplicate definition of 'float3 sin(float3 a)' | ||
float3 sin(float3 a) { return float3(0); /* error: overloads a builtin */ } | ||
^^^^^^^^^^^^^^^^^^^^ | ||
error: 12: duplicate definition of $genHType cos($genHType angle) | ||
error: 12: duplicate definition of 'half cos(half2 a)' | ||
half cos(half2 a) { return 0; /* error: overloads a builtin (despite return type mismatch) */ } | ||
^^^^^^^^^^^^^^^^^ | ||
error: 13: functions 'float2 cos(half2 a)' and '$genHType cos($genHType angle)' differ only in return type | ||
error: 13: functions 'float2 cos(half2 a)' and '$pure $genHType cos($genHType angle)' differ only in return type | ||
float2 cos(half2 a) { return 0; /* error: overloads a builtin (despite return type mismatch) */ } | ||
^^^^^^^^^^^^^^^^^^^ | ||
error: 15: duplicate definition of $genType pow($genType x, $genType y) | ||
error: 15: duplicate definition of 'float pow(float x, float y)' | ||
float pow(float x, float y) { return 0; /* error: overloads a builtin */ } | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
6 errors |