Skip to content

Initial and final newlines are missing from Block comments in the Context's Comment instances #2

@gilramir

Description

@gilramir

Initial and final newlines are missing from the data in the parser's Context data structure.

Given this input, for example:

  1 module Example exposing (..)
  2 
  3 x: Int
  4 x = 1
  5 
  6 {- Example 1
  7 Second line -}
  8 
  9 {-
 10 Example 2
 11 Second line -}
 12 
 13 {-
 14 Example 3
 15 Second Line
 16 -}
 17 

The Comment data for each example is:

Block <Example 1
Second line> @ row=6 col=1
Block <Example 2
Second line> @ row=9 col=1
Block <Example 3
Second Line> @ row=13 col=1

For Example 2, line 9 is the beginning of the comment, but the string "Example 2" actually starts on line 10.
For Example 3, we do not know that terminating "-}" is on a line by itself because the string "Second Line" doesn't have a terminating newline.

To reproduce:

  1. Clone the repo at https://github.com/gilramir/gren-bug-reports
  2. cd to the 2026-04-08-multiline-comment directory
  3. run "./run.sh"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions