fix(codemode): label supported and unsupported syntax in the hint (#48200)

This commit is contained in:
Aiden Cline
2026-09-09 12:33:22 -05:00
committed by GitHub
Unverified
parent 297019e321
commit 85dff53a1f
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ export class InterpreterRuntimeError extends Error {
// Orient the agent rather than enumerate JavaScript; interpreter-support.md is the full matrix.
export const supportedSyntaxMessage =
"Programs run a JavaScript subset for calling tools: plain and async functions, data literals, destructuring, standard control flow, await/Promise, and common built-ins (Array, Object, Math, JSON, Date, RegExp, Map, Set, URL). Classes, this, getters/setters, tagged templates, BigInt, and custom Symbols are unavailable; use plain functions and data objects instead."
"This is a restricted JavaScript-like language. Supported: plain and async functions, data literals, destructuring, standard control flow, await and Promise, and built-ins such as Array, Object, Math, JSON, Date, RegExp, Map, Set, and URL. Unsupported: classes, this, getters/setters, tagged templates, BigInt, and custom Symbols. Use plain functions and data objects instead."
export const unsupportedSyntax = (kind: string, node: AstNode): InterpreterRuntimeError =>
new InterpreterRuntimeError(
@@ -70,7 +70,11 @@ describe("new on a non-constructible callee", () => {
test("classes remain unsupported syntax", async () => {
const failure = await error(`class A {}; return new A()`)
expect(failure.kind).toBe("UnsupportedSyntax")
expect(failure.message).toStartWith("Syntax 'ClassDeclaration' is not supported. Programs run a JavaScript subset")
expect(failure.message).toContain("Classes, this, getters/setters, tagged templates, BigInt, and custom Symbols")
expect(failure.message).toStartWith(
"Syntax 'ClassDeclaration' is not supported. This is a restricted JavaScript-like language. Supported: ",
)
expect(failure.message).toContain(
"Unsupported: classes, this, getters/setters, tagged templates, BigInt, and custom Symbols.",
)
})
})