oniksan / godobuf

A Google Protobuf implementation for Godot / GDScript
BSD 3-Clause "New" or "Revised" License
248 stars 34 forks source link

Use typed arrays for fields #38

Closed rcorre closed 7 months ago

rcorre commented 8 months ago

Given:

message Foo {
    repeated int32 i = 1;
    repeated string s = 2;
    repeated Bar b = 3;
}

Currently we generate:

get_i() -> Array
get_s() -> Array
get_b() -> Array

With gdscript warnings enabled, this tends to generate lots of warnings in consuming code, and require "unsafe" casts that must be ignored. It would be nice if we could generate typed return values, like:

get_i() -> Array[int]
get_s() -> Array[string]
get_b() -> Array[Bar]