Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate unique dictionary members (including inheritance) #580

Open
foolip opened this issue Apr 26, 2021 · 4 comments
Open

Validate unique dictionary members (including inheritance) #580

foolip opened this issue Apr 26, 2021 · 4 comments

Comments

@foolip
Copy link
Member

foolip commented Apr 26, 2021

https://heycam.github.io/webidl/#idl-dictionaries says:

The identifier of a dictionary member must not be the same as that of another dictionary member defined on the dictionary or on that dictionary’s inherited dictionaries.

I tried if webidl2.js would catch such errors but it seems like not:

const { parse, validate } = require("webidl2");
const ast = parse(`dictionary A { any m; }; dictionary B : A { object m; };`);
const validations = validate(ast); // returns []
@foolip
Copy link
Member Author

foolip commented Apr 26, 2021

It actually looks like duplicating the member name on a single dictionary is also not validated for.

@foolip foolip changed the title Validate dictionary members do not shadow members of any inherited dictionary Validate unique dictionary members (including inheritance) Apr 26, 2021
@foolip
Copy link
Member Author

foolip commented Apr 26, 2021

I wrote up a quick check for this locally (in webref) but to my surprise there doesn't seem to be any duplicate member names currently.

@saschanaz
Copy link
Member

Yeah, the current name check only applies for parent types, not members. Something to be done later.

@saschanaz
Copy link
Member

I strongly feel that the implementation here will share the core logic with #584, but not something to worry about for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants