exaloop / exaloop/codon

using protobuf case

Open
#547 8 comments 0 reactions 1 assignee Claimed by @inumanag View on GitHub
Dominant language
Python
Stars
16.8k
Forks
603
Avg merge
4d 23h
Merged PRs (30d)
6

Description

defines `test.proto`
```protobuf
syntax = "proto3";
package tutorial;

enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}

message Person {
string name = 1;
int32 id = 2;
PhoneNumber phone = 4;
string email = 3;
}

message PhoneNumber {
string number = 1;
PhoneType type = 2;
}

message AddressBook {
repeated Person people = 1;
}
```
run generation cmd `protoc ./test.proto --python_out=./`

write proto.codon

```python
from python import test_pb2

def test_proto():
person = test_pb2.Person()
person.id = 123
person.name = "Jeff"
person.email = "123"
print(person)

test_proto()
```

run `codon run proto.codon`
```
proto.codon:5:5-11: error: 'pyobj' object has no attribute 'id'
╰─ proto.codon:10:1-11: error: during the realization of test_proto()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.