Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
test262
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pmaksimo
test262
Commits
772fb79f
Commit
772fb79f
authored
Oct 16, 2017
by
Daniel Ehrenberg
Committed by
GitHub
Oct 16, 2017
Browse files
Options
Downloads
Plain Diff
Merge pull request #1281 from cxielarko/bigint-bool-eq
ToPrimitive called without hint for boolean equality
parents
68e91249
a9092bdb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/language/expressions/equals/to-prim-hint.js
+35
-0
35 additions, 0 deletions
test/language/expressions/equals/to-prim-hint.js
with
35 additions
and
0 deletions
test/language/expressions/equals/to-prim-hint.js
0 → 100644
+
35
−
0
View file @
772fb79f
// Copyright (C) 2017 Robin Templeton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-abstract-equality-comparison
description: Object operands coerced without ToPrimitive hint
info: >
7.2.14 Abstract Equality Comparison
...
6. If Type(x) is Boolean, return the result of the comparison !
ToNumber(x) == y.
7. If Type(y) is Boolean, return the result of the comparison x == !
ToNumber(y).
8. If Type(x) is either String, Number, or Symbol and Type(y) is
Object, return the result of the comparison x == ToPrimitive(y).
9. If Type(x) is Object and Type(y) is either String, Number, or
Symbol, return the result of the comparison ToPrimitive(x) == y.
...
features: [Symbol.toPrimitive]
---*/
let
count
=
0
;
let
obj
=
{
[
Symbol
.
toPrimitive
](
hint
)
{
count
+=
1
;
assert
.
sameValue
(
hint
,
"
default
"
);
return
1
;
}
};
assert
.
sameValue
(
true
==
obj
,
true
);
assert
.
sameValue
(
count
,
1
);
assert
.
sameValue
(
obj
==
true
,
true
);
assert
.
sameValue
(
count
,
2
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment