-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
.load accumulates indentation #47673
Copy link
Copy link
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Version
v19.9.0
Platform
Microsoft Windows NT 10.0.22621.0 x64
Subsystem
repl
What steps will reproduce the bug?
example.jswith the following contents:node, and enter the following command:How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
I expect the REPL to repeat code exactly as it appears in
example.js:And then for the code to output:
(For example, this is the output from
node example.js.)What do you see instead?
The REPL repeats the code with accumulated indentation, where each line includes all of the indentation from all previous lines:
This results in incorrect behavior with the template string. The code outputs:
Additional information
This issue arose when using the
replpackage to make a REPL for an indentation-based language, Civet..loadis then nonfunctional; see DanielXMoore/Civet#509But it also affects correctness of JavaScript as illustrated above.