oskaritimperi / nimpb

Protocol Buffers for Nim
MIT License
37 stars 6 forks source link

Compiling error with generated nim file #15

Closed geohuz closed 4 years ago

geohuz commented 4 years ago

with the following proto file:

syntax = "proto3";

option java_package = "io.deepstream.protobuf";

enum TOPIC {
  UNKNOWN = 0;
  PARSER = 1;
  CONNECTION = 2;
  AUTH = 3;
  EVENT = 4;
  RECORD = 5;
  RPC = 6;
  PRESENCE = 7;
  MONITORING = 8;
  CLUSTER = 9;
  LOCK = 10;
  STATE_REGISTRY = 11;
  ERROR = 100;
}

message Message {
  TOPIC topic = 2;
  bytes message = 3;
}

The generated nim file has the following code:

type
    TOPIC* {.pure.} = enum
        UNKNOWN = 0
        PARSER = 1
        CONNECTION = 2
        AUTH = 3
        EVENT = 4
        RECORD = 5
        RPC = 6
        PRESENCE = 7
        MONITORING = 8
        CLUSTER = 9
        LOCK = 10
        STATE_REGISTRY = 11
        ERROR = 100
    Message* = ref MessageObj
    MessageObj* = object of Message
        topic: TOPIC
        message: seq[byte]

compile with error

Error: inheritance only works with non-final objects; to enable inheritance write 'Message of RootObj'

I guess it is conflicted with the nimpb's Message

oskaritimperi commented 4 years ago

It looks like that, yes. Do you have any proposals for nimpb how to get around this?

geohuz commented 4 years ago

I manually changed protospec to avoid the conflict