Reproduction: ```js console.log("hi") (async() => { console.log("hi"); console.log("hi"); console.log("hi"); console.log("hi"); console.log("hi"); console.log("hi"); })(); ``` This is interpreted as `console.log("hi")(/*...*/)();` and throws an error since `console.log("hi")` returns `undefined`. . V8 correctly diagnoses the error. Running in the Chrome DevTools shows the error: ``` Uncaught TypeError: console.log(...) is not a function ``` . Safari 16 and Bun 0.7.3 both misdiagnose the error: ``` TypeError: console.log is not a function. (In 'console.log("hi")', 'console.log' is undefined) ``` To be clear, `console.log` is not undefined in context. . This appears to be related to the size of the function body. For example, if one of the console calls is removed: ```js console.log("hi") (async() => { console.log("hi"); console.log("hi"); console.log("hi"); console.log("hi"); console.log("hi"); })(); ``` Safari and Bun both show correct error messages: ``` TypeError: console.log("hi") is not a function. (In 'console.log("hi") (async() => { console.log("hi"); console.log("hi"); console.log("hi"); console.log("hi"); console.log("hi"); })', 'console.log("hi") ' is undefined) ``` This message is correct: `console.log("hi")` is undefined.
<rdar://problem/114357179>
This incorrect error message is an accidental by-product of a truncated error message. I'll be fixing this by compressing ExpressionInfo as well as changing it to no longer discard divot info.
Pull request: https://github.com/WebKit/WebKit/pull/22880
Committed 273233@main (126d2027f1ce): <https://commits.webkit.org/273233@main> Reviewed commits have been landed. Closing PR #22880 and removing active labels.