Giter Site home page Giter Site logo

name collisions about elm-protobuf HOT 3 OPEN

tiziano88 avatar tiziano88 commented on July 24, 2024 1
name collisions

from elm-protobuf.

Comments (3)

tiziano88 avatar tiziano88 commented on July 24, 2024 1

Thanks for the comments! I think the correct thing to do here would be to rename the generated types to contain the parent message name. I will give it a try and post updates here. Thanks for your patience!

from elm-protobuf.

robx avatar robx commented on July 24, 2024

The compiler errors:

-- DUPLICATE DEFINITION -------------------------------- ./src/Proto/Triples.elm

Naming multiple top-level values `Change` makes things ambiguous. When you say
`Change` which one do you want?

225|>type alias Change =
226|>    { changeOneof : ChangeOneof
227|>    }

Find all the top-level values named `Change` and do some renaming. Make sure the
names are distinct!

-- DUPLICATE DEFINITION -------------------------------- ./src/Proto/Triples.elm

Naming multiple top-level values `Event` makes things ambiguous. When you say
`Event` which one do you want?

78|>type alias Event =
79|>    { eventOneof : EventOneof
80|>    }

Find all the top-level values named `Event` and do some renaming. Make sure the
names are distinct!

-- DUPLICATE DEFINITION -------------------------------- ./src/Proto/Triples.elm

Naming multiple top-level values `Match` makes things ambiguous. When you say
`Match` which one do you want?

13|>type ClaimType
14|>    = Match -- 0
15|>    | Nomatch 

Find all the top-level values named `Match` and do some renaming. Make sure the
names are distinct!

Detected errors in 1 module.                                        

from elm-protobuf.

ftc avatar ftc commented on July 24, 2024

This is an issue for me as well. I created a simplified proto file that exhibits this problem:

syntax = "proto3";

package com.example;

message FirstMessage {
        oneof same_fieldname{
                string foo = 1;
                int32 bar = 2;
        }

}
message SecondMessage{
        oneof same_fieldname{
                int64 baz = 1;
                string bip = 2;
        }
}

All of the files to reproduce this bug are uploaded here:
ElmProtoBug.zip

Running elm-reactor and navigating to http://localhost:8000/src/Bad.elm reproduces the problem.

Error output

Starting downloads...

  ● elm-lang/virtual-dom 2.0.4
  ● tiziano88/elm-protobuf 2.1.0
  ● elm-lang/core 5.1.1
  ● elm-lang/html 2.0.0
  ● jweir/elm-iso8601 
3.0.2
Packages configured successfully!
Detected errors in 1 module.


-- DUPLICATE DEFINITION -------------------------------------------- src/Bad.elm

Naming multiple top-level values `sameFieldnameDecoder` makes things ambiguous.
When you say `sameFieldnameDecoder` which one do you want?

70| sameFieldnameDecoder =
    ^^^^^^^^^^^^^^^^^^^^
Find all the top-level values named `sameFieldnameDecoder` and do some renaming.
Make sure the names are distinct!



-- DUPLICATE DEFINITION -------------------------------------------- src/Bad.elm

Naming multiple top-level values `sameFieldnameEncoder` makes things ambiguous.
When you say `sameFieldnameEncoder` which one do you want?

79| sameFieldnameEncoder v =
    ^^^^^^^^^^^^^^^^^^^^
Find all the top-level values named `sameFieldnameEncoder` and do some renaming.
Make sure the names are distinct!



-- DUPLICATE DEFINITION -------------------------------------------- src/Bad.elm

Naming multiple top-level values `SameFieldnameUnspecified` makes things
ambiguous. When you say `SameFieldnameUnspecified` which one do you want?

19|>type SameFieldname
20|>    = SameFieldnameUnspecified
21|>    | Foo String
22|>    | Bar Int

Find all the top-level values named `SameFieldnameUnspecified` and do some
renaming. Make sure the names are distinct!



-- DUPLICATE DEFINITION -------------------------------------------- src/Bad.elm

There are multiple types named `SameFieldname` in this module.

19|>type SameFieldname
20|>    = SameFieldnameUnspecified
21|>    | Foo String
22|>    | Bar Int

Search through this module, find all the types named `SameFieldname`, and give
each of them a unique name.

Workaround: Changing the proto file to the following fixes the problem

syntax = "proto3";

package com.example;

message FirstMessage {
        oneof same_fieldname{
                string foo = 1;
                int32 bar = 2;
        }

}
message SecondMessage{
        oneof different_fieldname{
                int64 baz = 1;
                string bip = 2;
        }
}

from elm-protobuf.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.