Open Bug 1933558 Opened 1 year ago Updated 1 year ago

`Cannot coerce default dictionary value to type USVStringDoubleRecord.`

Categories

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

task

Tracking

()

People

(Reporter: ErichDonGubler, Unassigned)

References

(Blocks 2 open bugs)

Details

While working on bug 1933548, I discovered that setting a default value of {} for a record<USVString, GPUPipelineConstantValue> dictionary field throws the following error during IDL bindings generation:

 0:29.47 WebIDL.WebIDLError: error: Cannot coerce default dictionary value to type USVStringDoubleRecord., <snip>/dom/webidl/WebGPU.webidl line 662:48

This seems like something that should be permitted; an empty dictionary should simply coerce to an empty record, right? 🤔

Type: defect → task

{} is for dictionaries per the spec: https://webidl.spec.whatwg.org/#idl-operations

Optional argument default values can also be specified using the two token value {}, which represents a default-initialized (as if from ES null or an object with no properties) dictionary value.

I don't think there's a default value syntax available for records, maybe worth filing a spec bug?

You need to log in before you can comment on or make changes to this bug.