TypeError: iterable is not iterable
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox83 | --- | fixed |
People
(Reporter: pomax, Assigned: arai)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0
Steps to reproduce:
var a = new Set([1,2,3]);
var b = new Set([2,3,4]);
var c = new Set(...a, ...b);
Actual results:
This throws an error "Uncaught TypeError: iterable is not iterable", which is quite impressive
Expected results:
A TypeError that wasn't self-contraditory. The Set
constructor takes a single argument, which must be an iterable, so if you call it as new Set(1)
you get an error that makes sense:
"Uncaught TypeError: 1 is not iterable"
But it seems to not actually report on the true argument when deferencing: it feels like it's trying to report on the construction ...input
itself, rather than on what that actually turns into (namely, single elements).
Note that this will not happen for something like new Set('a', 'b', 'c')
or new Set(...['a','b','c'])
as strings are iterable. You'll just get a single element Set containing just a
in both cases.
Assignee | ||
Comment 2•4 years ago
|
||
it's using the following variable name for reporting
https://searchfox.org/mozilla-central/rev/5efefd3ef214ed6d3234ba245c1da3004ead94e0/js/src/builtin/Set.js#18
function SetConstructorInit(iterable) {
...
for (var nextValue of allowContentIter(iterable))
fix would be either:
- use more descriptive variable name there
- do not use decompiler for self-hosted JS code
Assignee | ||
Comment 3•4 years ago
|
||
the same happens for WeakSet.
https://searchfox.org/mozilla-central/rev/5efefd3ef214ed6d3234ba245c1da3004ead94e0/js/src/builtin/WeakSet.js#7-18
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
We already have a logic that tries to get arguments, but if it fails, it prints parameter name.
https://searchfox.org/mozilla-central/rev/5efefd3ef214ed6d3234ba245c1da3004ead94e0/js/src/vm/BytecodeUtil.cpp#1782-1808
we should instead abort decompiler for this case.
Assignee | ||
Comment 5•4 years ago
|
||
Updated•4 years ago
|
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/f50e7b70132a Do not use self-hosted JS parameter name in decompiler. r=evilpie
Comment 7•4 years ago
|
||
bugherder |
Description
•