[Webkit-unassigned] [Bug 260324] New: Incorrect error message in accidental function call
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Aug 16 19:09:12 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=260324
Bug ID: 260324
Summary: Incorrect error message in accidental function call
Product: WebKit
Version: Safari 16
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: dev at sheetjs.com
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.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230817/a7dfbee0/attachment.htm>
More information about the webkit-unassigned
mailing list