Skip to content

String literals concatenation not optimized anymore in compiler output #5490

Closed
@cknitt

Description

@cknitt

Another small regression in compiler output where an optimization for string literals is not applied anymore. Consider the following code:

let mediaSubDirectory = "media"

let f = filename => "../Documents/" ++ mediaSubDirectory ++ "/" ++ filename

In ReScript 9, this compiles to:

var mediaSubDirectory = "media";

function f(filename) {
  return "../Documents/media/" + filename;
}

In current master, I get

var mediaSubDirectory = "media";

function f(filename) {
  return "../Documents/" + mediaSubDirectory + "/" + filename;
}

(The same behavior can be reproduced in ReScript 9.1.4 by making mediaSubdirectory a backtick string.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions