Skip to content

Conversation

WWRS
Copy link
Contributor

@WWRS WWRS commented Mar 17, 2025

Fixes #6334

These were previously hardcoded to be equal, and I'm not completely sure why. I hope I'm not missing something.

It's not mentioned in the PR when it was added (#6153). I suspect it was a port of the old system, where constructors were checked rather than prototypes: Undefined constructor could equal Object constructor. But undefined prototype should not equal Object prototype.

@WWRS WWRS requested a review from kt3k as a code owner March 17, 2025 15:32
@CLAassistant
Copy link

CLAassistant commented Mar 17, 2025

CLA assistant check
All committers have signed the CLA.

@@ -383,6 +383,18 @@ Deno.test("equal() with constructor and prototype", async (t) => {
});
});

Deno.test("equal() considers object with prototype Object.prototype not equal to object with no prototype", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this too long a name? Suggestions on making it shorter?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks just fine to me

@WWRS WWRS marked this pull request as draft March 17, 2025 15:39
@WWRS
Copy link
Contributor Author

WWRS commented Mar 17, 2025

Changed to draft because I realized this makes behavior different when objects have properties: #6334 (comment)

@iuioiua
Copy link
Contributor

iuioiua commented Sep 9, 2025

This PR hasn't had activity in almost 6 months. Should we close as stale for now?

@WWRS
Copy link
Contributor Author

WWRS commented Sep 10, 2025

We would need to disambiguate the behavior mentioned in #6334. Determining this behavior doesn't seem like a priority, so if this PR is not moving toward either being outright accepted or outright rejected, it's stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@std/assert/equals considers Object.create(null) and {} to be equal
4 participants