Skip to content

Clarify order of well-known-type conversion vs. selection, indexing, and type check #76

Open
@JimLarson

Description

@JimLarson

The language spec doesn't clearly explain how the automatic conversion of dynamic value protos interacts with type checking and runtime selection/indexing. For instance, given the following proto definitions:

message FakeAny {
    bytes value = 2;
}

and the following declarations and bindings

a: google.protobuf.Int64Value = 7
b: google.protobuf.Any = {...encoding of FakeAny{ value: "\377\377\377" }...}

do the following expressions type check, and what do they evaluate to?

a + 3
a.int_value + 3
b.value
b.value.value

I believe that what's intended is that the first and third will execute without error yielding 10 and b'\377\377\377' respectively, while the second and fourth should fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions