Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

The new operator failed to set prototypes correctly when a constructor's prototype was a JsArray or other IJsPropertyAccessor type rather than a JsObject. This broke subclassed array patterns used in Test262 tests.

Changes

  • NewExpressionExtensions.cs: Changed prototype type check from is JsObject to is IJsPropertyAccessor to accept any valid JS object-like type as a constructor prototype
// Before: only JsObject prototypes worked
if (TryGetPropertyValue(constructor, "prototype", out var prototype) && prototype is JsObject proto)

// After: JsArray and other IJsPropertyAccessor types work as prototypes
if (TryGetPropertyValue(constructor, "prototype", out var prototype) && prototype is IJsPropertyAccessor)

This enables prototype chain lookups for patterns like:

foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.every(cb);  // Now correctly finds Array.prototype.every

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: /usr/bin/curl curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

run tests from "public class BuiltInsTests : Test262Test" specifically tests where the test method is named "Array_prototype_*"

see what fails, then try to fix those things


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 1, 2025 22:33
Co-authored-by: rogeralsing <647031+rogeralsing@users.noreply.github.com>
Co-authored-by: rogeralsing <647031+rogeralsing@users.noreply.github.com>
Copilot AI changed the title [WIP] Run and fix Array prototype tests in BuiltInsTests Fix prototype chain for non-JsObject prototypes in constructor calls Dec 1, 2025
Copilot finished work on behalf of rogeralsing December 1, 2025 22:48
Copilot AI requested a review from rogeralsing December 1, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants