From 8eeb5f358b9cb69a17a1e97395856aa66272ffc9 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Mon, 8 Dec 2025 10:18:42 -0500 Subject: [PATCH] Nested heredoc with newline terminator When you have a heredoc interpolated into another heredoc where the inner heredoc is terminated by a newline, you need to avoid adding the newline character a second time. --- src/prism.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/prism.c b/src/prism.c index 93392da349..58a11dd89d 100644 --- a/src/prism.c +++ b/src/prism.c @@ -12024,7 +12024,10 @@ parser_lex(pm_parser_t *parser) { // string content. if (heredoc_lex_mode->indent == PM_HEREDOC_INDENT_TILDE) { const uint8_t *end = parser->current.end; - pm_newline_list_append(&parser->newline_list, end); + + if (parser->heredoc_end == NULL) { + pm_newline_list_append(&parser->newline_list, end); + } // Here we want the buffer to only // include up to the backslash.