Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Mixing conversions and submodule's isn't using the conversion #414

Description

@tomgasson
[@genType]
type t =
  | A
  | B({name: string});

module X = {
  [@genType]
  let foo = (t: t) => {
    switch (t) {
    | A => Js.log("A")
    | B({name}) => Js.log("B" ++ name)
    };
  };
};

Gives

type $any = any;

const $$toRE552311971 = {"A": 0};

// $FlowExpectedError: Reason checked type sufficiently
const CreateBucklescriptBlock = require('bs_block');

// $FlowExpectedError: Reason checked type sufficiently
const GenTypeBugBS = require('GenTypeBug.bs');

export type t = "A" | {| +name: string |};

const X_foo: (t) => void = function (Arg1: $any) {
  const result = GenTypeBugBS.X.foo(typeof(Arg1) === 'object'
    ? CreateBucklescriptBlock.__(0, Arg1)
    : $$toRE552311971[Arg1]);
  return result
};;
exports.X_foo = X_foo

const X: { foo: (t) => void, ... } = GenTypeBugBS.X;
exports.X = X

A call to Module.X.foo("A") won't use X_foo, it will use the BS.X.foo method directly

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