Closed Bug 1531623 Opened 8 months ago Closed 8 months ago

Identifier conflicts involving typedefs are inscrutable

Categories

(Core :: DOM: Bindings (WebIDL), enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

If I try to parse this IDL:

  typedef long foo;
  typedef long foo;

I get an exception like so:

  AttributeError: 'IDLTypedef' object has no attribute 'innerType'

This is not helpful. It happens because IDLTypedef.__init__ tries to resolve the identifier conflict before assigning self.innerType, but when that fails it tries to call __str__ in the IDLTypedef, which tries to use self.innerType.

We should either assign .innerType first or change __str__ to deal. If I do the assignment first, then for my testcase I get:

  WebIDLError: error: Multiple unresolvable definitions of identifier 'foo' in scope '::
        Typedef foo Long at <unknown> line 2:4
    typedef long foo;
    ^
        Typedef foo Long at <unknown> line 3:4
    typedef long foo;
    ^

which is a lot nicer.

Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5ab896c5a05d
Fix webidl identifier conflicts involving typedefs to produce saner exceptions.  r=qdot
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Assignee: nobody → bzbarsky
You need to log in before you can comment on or make changes to this bug.