ahamez / protox

A fast, easy to use and 100% conformant Elixir library for Google Protocol Buffers (aka protobuf)
MIT License
269 stars 18 forks source link

Unexpected list in typespec: [:high, :low] #2

Closed MartinElvar closed 6 years ago

MartinElvar commented 6 years ago

Hi,

First of all, thank you for putting effort into this library. :-)

I'm trying to compile the counter strike proto files found here https://github.com/SteamRE/SteamKit/blob/master/Resources/Protobufs/csgo/cstrike15_usermessages.proto

If i run protoc -I./ --descriptor_set_out=./protox_test.test cstrike15_usermessages.proto i get no errors, and my file is populated.

But when i run

defmodule Demex.UserMessages do
  @external_resource "./lib/protobufs/cstrike15_usermessages.proto"

  use Protox, files: [
    "./lib/protobufs/cstrike15_usermessages.proto",
  ], namespace: Ost
 end

I can't compile my project, getting the following compile error.

⇒  mix compile
Compiling 1 file (.ex)
[libprotobuf WARNING google/protobuf/compiler/parser.cc:546] No syntax specified for the proto file: cstrike15_usermessages.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
[libprotobuf WARNING google/protobuf/compiler/parser.cc:546] No syntax specified for the proto file: netmessages.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
[libprotobuf WARNING google/protobuf/compiler/parser.cc:546] No syntax specified for the proto file: cstrike15_gcmessages.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
[libprotobuf WARNING google/protobuf/compiler/parser.cc:546] No syntax specified for the proto file: steammessages.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
cstrike15_usermessages.proto: warning: Import google/protobuf/descriptor.proto but not used.
Compiling lib/user_messages.ex (it's taking more than 15s)

== Compilation error in file lib/user_messages.ex ==
** (CompileError) lib/user_messages.ex:4: unexpected list in typespec: [:high, :low]
    (elixir) lib/kernel/typespec.ex:1171: Kernel.Typespec.compile_error/2
    (elixir) lib/kernel/typespec.ex:1160: Kernel.Typespec.typespec/3
    (elixir) lib/kernel/typespec.ex:1189: Kernel.Typespec.fn_args/5
    (elixir) lib/kernel/typespec.ex:544: Kernel.Typespec.translate_spec/7

I simply don't know where to look, hope someone can help me.

Could i be, that it's trying to parse this. https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto#L690

MartinElvar commented 6 years ago

Seems to be different params.

== Compilation error in file lib/user_messages.ex ==
** (CompileError) lib/user_messages.ex:4: unexpected list in typespec: [:is_extension, :name_part]

Even tho. i don't change a thing.

ahamez commented 6 years ago

Hello, thanks for the report! It's fixed by 0.16.2, available on hex.pm.

MartinElvar commented 6 years ago

Works like a charm, thx for the quick action.