In WebIDL, I need to specify two union types that only differ in the attributes that apply to the string.
typedef (DOMString or TrustedScript) ScriptString;
typedef ([TreatNullAs=NullString] DOMString or TrustedScript) ScriptStringWithExtras;
The IDL compiler generates the same C++ and file names for either:
class StringOrTrustedScript;
string_or_trusted_script.{h,cc}
This means that they cannot co-exist.
I require the TreatNullAs attribute to remain compatible with existing APIs, so I also cannot easily change my design to avoid this situation.
--------------
I presume the intent is that structurally identical types should be identical (e.g., (A or B) == (B or A)). If so, this would make a lot of sense, except that the attribute makes those two string types actually slightly different.
Context 1: crrev.com/c/1178046
Context 2: Union types w/ attributes do seem to occur, but are clearly not very common:
https://cs.chromium.org/search/?q=file:%5C.idl$+%5C(%5C%5B.*%5Cbor%5Cb&sq=package:chromium&type=cs
-------------------------------
Chrome Version: M70
OS: All, presumably.
What steps will reproduce the problem?
Have an .idl with both defintions given above, and see what they produce.
What is the expected result?
There needs to be a way to distinguish between the two helper classes. (I'm not sure about the file name. Both variants being generated into the same file would be ok, too.)
What happens instead?
The have the same name.
Comment 1 by peria@chromium.org
, Oct 12