Skip to content

invalid_code_point reports wrong range for triple-quoted strings #46005

Closed

Description

@DanTup

Triple-quoted strings seem to report invalid_code_point with the wrong range (as if the surrounding quotes length is assumed to always be 1 character):

var a = '\u{2388999}';
var b = '''\u{2388999}''';

Screenshot 2021-05-13 at 09 59 39

Activity

  1. added
    contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)
    on May 20, 2022
  2. added
    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
    on Mar 14, 2024
  3. added
    area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
    and removed on Feb 27, 2025
  4. keertip commented on Sep 22, 2026

    @keertip
    Contributor

    Still reproducible at HEAD (verified on a local build of main, 3.14.0-edge.795842f).

    var a = '\u{2388999}';
    var b = '''\u{2388999}''';

    dart analyze --format=json (offsets only):

    line escape starts at reported range
    1 ('...') 9 9–18
    2 ('''...''') 34 32–41

    For the triple-quoted string the reported range starts at offset 32, which is inside the opening ''' delimiter, i.e. the reported offset is two characters early — consistent with the quote length being assumed to be 1. (The same off-by-two applies to invalid_unicode_escape_u_bracket, which is reported at the same location.)

  5. Yusufihsangorgel commented on Oct 13, 2026

    @Yusufihsangorgel
    Contributor

    Fixed by b4b21d3 (https://dart-review.googlesource.com/c/sdk/+/553940). With 3.15.0-10.0.dev both diagnostics on the triple-quoted line now start at offset 34, the start of the escape.

  6. DanTup commented on Oct 13, 2026

    @DanTup
    CollaboratorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)devexp-uxtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)verified-by-an-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions