Skip to content

Generator: does not seem to use opened modules #34

@Cjen1

Description

@Cjen1

If I have two files as follows:

a.ml

module Foo = struct
type value = int [@@deriving protobuf {protoc }

and b.ml

open A
type value2 = Foo.value
type value3 = {value: value2} [@@deriving protobuf {protoc}]

the generated protobuffer for b will be approximately:

import "A.Foo.protoc"
message value2 {
  required Foo.value _ = 1;
}

message value3 {
  required value2 value = 1;
}

This however won't compile since Foo.value is undefined, but A.Foo.value is defined.

If in b.ml:

type value2 = A.Foo.value

Then A.Foo.value is generated instead.

My suggestion would be to just amend the readme to fix this if a more correct fix is not possible.

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