Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/productions/argument.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export class Argument extends Base {
const message = `Optional dictionary arguments must have a default value of \`{}\`.`;
yield validationError(this.source, this.tokens.name, this, message);
}
if (this.idlType.nullable) {
const message = `Dictionary arguments cannot be nullable.`;
yield validationError(this.source, this.tokens.name, this, message);
}
}
}
}
12 changes: 12 additions & 0 deletions test/invalid/baseline/argument-dict-nullable.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Validation error at line 13 in argument-dict-nullable.webidl, inside `argument dict`:
x2(optional Dict? dict = {})
^ Dictionary arguments cannot be nullable.
Validation error at line 14 in argument-dict-nullable.webidl, inside `argument union`:
boolean or Dict)? union = {})
^ Dictionary arguments cannot be nullable.
Validation error at line 15 in argument-dict-nullable.webidl, inside `argument union`:
z2(optional Union? union = {})
^ Dictionary arguments cannot be nullable.
Validation error at line 16 in argument-dict-nullable.webidl, inside `argument req`:
void r(Required? req);
^ Dictionary arguments cannot be nullable.
17 changes: 17 additions & 0 deletions test/invalid/idl/argument-dict-nullable.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
dictionary Dict {
short x = 0;
};

dictionary Required {
required short x;
};

typedef (short or Dict) Union;

[Exposed=Window]
interface X {
void x2(optional Dict? dict = {});
void y2(optional (boolean or Dict)? union = {});
void z2(optional Union? union = {});
void r(Required? req);
};