Skip to content

Commit 73a4d57

Browse files
fix(ecmascript): Canonicalize array values in the Set constructor (#918)
1 parent 87e9118 commit 73a4d57

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

nova_vm/src/ecmascript/builtins/keyed_collections/set_objects/set_constructor.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ use crate::{
1818
builders::builtin_function_builder::BuiltinFunctionBuilder,
1919
builtins::{
2020
ArgumentsList, Behaviour, Builtin, BuiltinGetter, BuiltinIntrinsicConstructor,
21-
array::ArrayHeap, ordinary::ordinary_create_from_constructor, set::Set,
21+
array::ArrayHeap,
22+
keyed_collections::map_objects::map_prototype::canonicalize_keyed_collection_key,
23+
ordinary::ordinary_create_from_constructor, set::Set,
2224
},
2325
execution::{Agent, JsResult, ProtoIntrinsics, Realm, agent::ExceptionType},
2426
types::{
@@ -164,7 +166,7 @@ impl SetConstructor {
164166
.values
165167
.iter()
166168
.for_each(|value| {
167-
let value = value.unwrap();
169+
let value = canonicalize_keyed_collection_key(numbers, value.unwrap());
168170
let value_hash = hasher(value);
169171
let next_index = values.len() as u32;
170172
let entry = set_data.entry(

tests/expectations.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,8 +1460,6 @@
14601460
"built-ins/RegExp/unicode_restricted_identity_escape_c.js": "FAIL",
14611461
"built-ins/RegExpStringIteratorPrototype/next/regexp-tolength-lastindex-throws.js": "FAIL",
14621462
"built-ins/Set/proto-from-ctor-realm.js": "FAIL",
1463-
"built-ins/Set/prototype/add/will-not-add-duplicate-entry-normalizes-zero.js": "FAIL",
1464-
"built-ins/Set/prototype/delete/delete-entry-normalizes-zero.js": "FAIL",
14651463
"built-ins/Set/prototype/difference/add-not-called.js": "FAIL",
14661464
"built-ins/Set/prototype/difference/allows-set-like-class.js": "FAIL",
14671465
"built-ins/Set/prototype/difference/allows-set-like-object.js": "FAIL",
@@ -1612,7 +1610,6 @@
16121610
"built-ins/Set/prototype/union/subclass.js": "FAIL",
16131611
"built-ins/Set/prototype/union/union.js": "FAIL",
16141612
"built-ins/Set/set-iterable-calls-add.js": "FAIL",
1615-
"built-ins/Set/valid-values.js": "FAIL",
16161613
"built-ins/ShadowRealm/WrappedFunction/length-throws-typeerror.js": "FAIL",
16171614
"built-ins/ShadowRealm/WrappedFunction/length.js": "FAIL",
16181615
"built-ins/ShadowRealm/WrappedFunction/name-throws-typeerror.js": "FAIL",

tests/metrics.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"results": {
33
"crash": 70,
4-
"fail": 7450,
5-
"pass": 39832,
4+
"fail": 7447,
5+
"pass": 39835,
66
"skip": 3326,
77
"timeout": 18,
88
"unresolved": 37

0 commit comments

Comments
 (0)