Closed Bug 1307115 Opened 8 years ago Closed 8 years ago

WebIDL.py should have better error messages on duplicate entries

Categories

(Core :: DOM: Core & HTML, defect)

All
Unspecified
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: ignisvulpis, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached patch WebIDL.py.patchSplinter Review
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 Build ID: 20161002030227 Steps to reproduce: Created a webidl in dom/webidl and added it to dom/webidl/moz.build webidl contains dublicate definition of an enum ./mach build -j1 Actual results: bad error message: 0:05.80 Traceback (most recent call last): 0:05.80 File "/usr/local/lib/python2.7/runpy.py", line 174, in _run_module_as_main 0:05.80 "__main__", fname, loader, pkg_name) 0:05.80 File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code 0:05.80 exec code in run_globals 0:05.80 File "/home/ignisvulpis/development/gecko-dev/python/mozbuild/mozbuild/action/webidl.py", line 19, in <module> 0:05.80 sys.exit(main(sys.argv[1:])) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/python/mozbuild/mozbuild/action/webidl.py", line 15, in main 0:05.80 manager.generate_build_files() 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/mozwebidlcodegen/__init__.py", line 246, in generate_build_files 0:05.80 self._parse_webidl() 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/mozwebidlcodegen/__init__.py", line 331, in _parse_webidl 0:05.80 parser.parse(data, path) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 6715, in parse 0:05.80 self._productions.extend(self.parser.parse(lexer=self.lexer, tracking=True)) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/other-licenses/ply/ply/yacc.py", line 263, in parse 0:05.80 return self.parseopt(input,lexer,debug,tracking,tokenfunc) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/other-licenses/ply/ply/yacc.py", line 710, in parseopt 0:05.80 p.callable(pslice) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 5563, in p_Enum 0:05.80 p[0] = IDLEnum(location, self.globalScope(), identifier, values) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 1926, in __init__ 0:05.80 IDLObjectWithIdentifier.__init__(self, location, parentScope, name) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 410, in __init__ 0:05.80 self.resolve(parentScope) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 417, in resolve 0:05.80 self.identifier.resolve(parentScope, self) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 390, in resolve 0:05.80 scope.ensureUnique(self, object) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 274, in ensureUnique 0:05.80 object) 0:05.80 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 308, in resolveIdentifierConflict 0:05.80 if (originalObject.tag == IDLInterfaceMember.Tags.Method and 0:05.80 AttributeError: 'IDLEnum' object has no attribute 'tag' 0:05.86 make[5]: *** [codegen.pp] Error 1 0:05.86 make[4]: *** [dom/bindings/export] Error 2 0:05.86 make[3]: *** [export] Error 2 0:05.86 make[2]: *** [default] Error 2 0:05.86 make[1]: *** [realbuild] Error 2 0:05.86 make: *** [build] Error 2 Expected results: 0:05.15 Traceback (most recent call last): 0:05.15 File "/usr/local/lib/python2.7/runpy.py", line 174, in _run_module_as_main 0:05.15 "__main__", fname, loader, pkg_name) 0:05.15 File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code 0:05.15 exec code in run_globals 0:05.15 File "/home/ignisvulpis/development/gecko-dev/python/mozbuild/mozbuild/action/webidl.py", line 19, in <module> 0:05.15 sys.exit(main(sys.argv[1:])) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/python/mozbuild/mozbuild/action/webidl.py", line 15, in main 0:05.15 manager.generate_build_files() 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/mozwebidlcodegen/__init__.py", line 246, in generate_build_files 0:05.15 self._parse_webidl() 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/mozwebidlcodegen/__init__.py", line 331, in _parse_webidl 0:05.15 parser.parse(data, path) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 6720, in parse 0:05.15 self._productions.extend(self.parser.parse(lexer=self.lexer, tracking=True)) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/other-licenses/ply/ply/yacc.py", line 263, in parse 0:05.15 return self.parseopt(input,lexer,debug,tracking,tokenfunc) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/other-licenses/ply/ply/yacc.py", line 710, in parseopt 0:05.15 p.callable(pslice) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 5568, in p_Enum 0:05.15 p[0] = IDLEnum(location, self.globalScope(), identifier, values) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 1931, in __init__ 0:05.15 IDLObjectWithIdentifier.__init__(self, location, parentScope, name) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 415, in __init__ 0:05.15 self.resolve(parentScope) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 422, in resolve 0:05.15 self.identifier.resolve(parentScope, self) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 395, in resolve 0:05.15 scope.ensureUnique(self, object) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 274, in ensureUnique 0:05.15 object) 0:05.15 File "/home/ignisvulpis/development/gecko-dev/dom/bindings/parser/WebIDL.py", line 321, in resolveIdentifierConflict 0:05.15 % (identifier.name, str(self), conflictdesc), []) 0:05.15 WebIDL.WebIDLError: error: Oops: Multiple unresolvable definitions of identifier 'Transport' in scope ':: 0:05.15 <WebIDL.IDLEnum object at 0x2b52e1253e90> at /home/ignisvulpis/development/gecko-dev/dom/webidl/CredentialManagement.webidl line 1:0 0:05.15 enum Transport { 0:05.15 ^ 0:05.15 <WebIDL.IDLEnum object at 0x2b52e349dc90> at /home/ignisvulpis/development/gecko-dev/dom/webidl/U2F.webidl line 22:0 0:05.15 enum Transport { 0:05.15 ^ 0:05.21 make[5]: *** [codegen.pp] Error 1 0:05.21 make[4]: *** [dom/bindings/export] Error 2 0:05.21 make[3]: *** [export] Error 2 0:05.21 make[2]: *** [default] Error 2 0:05.21 make[1]: *** [realbuild] Error 2 0:05.21 make: *** [build] Error 2
Component: Untriaged → Build Config
Flags: needinfo?(bzbarsky)
Product: Firefox → Core
Hardware: Unspecified → All
Version: 52 Branch → Trunk
Status: UNCONFIRMED → NEW
Component: Build Config → DOM
Ever confirmed: true
Summary: WebIDL.py better error messages on duplicate entries → WebIDL.py should have better error messages on duplicate entries
Thank you for the patch. I think it would be better to just fix the check for methods to use isinstance(...., IDLMethod). Are you willing to do that, or should I just pick this up?
Flags: needinfo?(bzbarsky) → needinfo?(ignisvulpis)
Please pick this up.
Flags: needinfo?(ignisvulpis)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8797669 [details] [diff] [review] Improve error reporting on name collisions in webidl Review of attachment 8797669 [details] [diff] [review]: ----------------------------------------------------------------- Yay clearer error messages!
Attachment #8797669 - Flags: review?(kyle) → review+
Pushed by bzbarsky@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/fb9a316a45d4 Improve error reporting on name collisions in webidl. r=qdot
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: