Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing type of record type's field. #86

Open
aidmandorky opened this issue Feb 16, 2023 · 0 comments
Open

Changing type of record type's field. #86

aidmandorky opened this issue Feb 16, 2023 · 0 comments

Comments

@aidmandorky
Copy link

aidmandorky commented Feb 16, 2023

Hello there, and many thanks for this wonderful extension. I am using ppx_import version 1.10.0.
I just had a question about using the [@with] directive. My use case is that I have a module with a record type:

module A = struct
  type foo1 = Z.t

  type foo2 = { bla: Z.t }
end

And I want to convert both the Z.t types into int. in this situation, the following works:

module B = struct
  type bar = [%import: (A.foo1[@with Z.t := int])]
end

while this doesn't:

module C = struct
  type bar = [%import: (A.foo2[@with Z.t := int])]
end

raising the error:

Error: This variant or record definition does not match that of type
         A.foo2
       Fields do not match:
         bla : Z.t;
       is not the same as:
         bla : int;
       The type A.foo1 is not equal to the type int

Is this intended behaviour or am I doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant