Skip to content

Optimizations lost in uncurried mode #6879

Closed
@cknitt

Description

@cknitt
  • Inlining lost in jscomp/gentype_tests/typescript-react-example/src/Records.res
  • Temporary variable introduced in jscomp/test/bs_poly_mutable_set_test.res
  • Belt_SetString.fromArray/toArray example

This is a follow-up to my comments on the diffs in #6864.

Inlining lost in the output for jscomp/gentype_tests/typescript-react-example/src/Records.res:

let getOpt = (opt, default, foo) => opt->Option.mapWithDefault(default, foo)

Before (curried mode):

let getOpt = Belt_Option.mapWithDefault;

After (uncurried mode):

function getOpt(opt, $$default, foo) {
  return Belt_Option.mapWithDefault(opt, $$default, foo);
}

Temporary variable introduced in jscomp/test/bs_poly_mutable_set_test.res:

Input:

b(__LOC__, N.isEmpty(N.intersect(aa, bb)))

Before (curried mode):

b("File \"bs_poly_mutable_set_test.res\", line 96, characters 4-11", Belt_MutableSet.isEmpty(Belt_MutableSet.intersect(aa, bb)));

After (uncurried mode):

let d$1 = Belt_MutableSet.intersect(aa, bb);

b("File \"bs_poly_mutable_set_test.res\", line 96, characters 4-11", d$1.data === undefined);

(OTOH isEmpty is now inlined here which is good.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions