Skip to content

Bug: @log does not work on cases prefixed with module name #26

@farukg

Description

@farukg

All case which have a prefix won't be logged. In the generated js files the code for logging is missing. It took a while to find out but now i have a minimal example:

// RSLoggerBugExample.res
module Page = {
  type t =
    | Home
    | Profile
    | Welcome
}

@react.component
let make = (~page) =>
  @log
  switch page {
  | Page.Welcome => "Hello World"->React.string
  | Home => "Hello Home"->React.string
  | Page.Profile => "Hello Profile"->React.string
  }
// RSLoggerBugExample.bs.js
function RSLoggerBugExample(Props) {
  var page = Props.page;
  switch (page) {
    case /* Home */0 :
        Browser$ReScriptLogger.debug({
              rootModule: "RSLoggerBugExample",
              subModulePath: /* [] */0,
              value: "make",
              fullPath: "RSLoggerBugExample.make",
              filePath: "absolute path to the res file which a can not disable, but that is another issue :D"
            }, "Home");
        return "Hello Home";
    case /* Profile */1 :
        return "Hello Profile";
    case /* Welcome */2 :
        return "Hello World";
  }
}

I got this issue originally in the old reason-syntax. But I could reproduce this bug also in rescript. I'm using [email protected] & [email protected]

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