Skip to content

Commit 4c91962

Browse files
authored
WebIDL: Display Overloading Method Name in Assertion Errors (#23819)
When working with a large WebIDL file and a mistake occurs, it’s nearly impossible to determine where the overloading method is located. This small change simply adds the method name to the error message, making it easier to identify and resolve the issue: `AssertionError: overloading must differentiate by # of arguments (cannot have two signatures that differ by types but not by length)` ![image](https://github.com/user-attachments/assets/ae491f4a-c4c5-4d71-90ff-2da4610a35e0) By including the method identifier in the error message, it becomes much simpler to pinpoint the exact location to investigate, especially in WebIDL files exceeding 3,000 lines: `AssertionError: OffsetCenterOfMassShapeSettings: overloading must differentiate by # of arguments (cannot have two signatures that differ by types but not by length)` ![image](https://github.com/user-attachments/assets/6603d63e-e01c-463f-8aa1-972d1d50da9b)
1 parent 3438fde commit 4c91962

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/webidl_binder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ def add_bounds_check_impl():
768768
assert return_type == ret.name, 'overloads must have the same return type'
769769
for i in range(len(args) + 1):
770770
if i == len(args) or args[i].optional:
771-
assert i not in sigs, 'overloading must differentiate by # of arguments (cannot have two signatures that differ by types but not by length)'
771+
assert i not in sigs, f'{m.identifier.name}: overloading must differentiate by # of arguments (cannot have two signatures that differ by types but not by length)'
772772
sigs[i] = args[:i]
773773
render_function(name,
774774
m.identifier.name, sigs, return_type,

0 commit comments

Comments
 (0)