Section 18.1 lists compile-time known and local compile-time known values.
The list does not include field access with . and index access with [ ].
But there are use cases in the p4c test suite that expects such.
// struct.p4, struct1.p4
const T t = { 32s10, 32s20 };
const int<32> x = t.t1;
// tuple3.p4
const tuple<bit<32>, bit<32>> t = { 0, 1 };
const bit<32> f = t[0];
How about adding the following cases to the list in 18.1?
For a field access, accessing a field of a local compile-time known / compile-time known expression results in a local-compile time known / compile-time known value, respectively.
The extra cases of compile-time known and local compile-time known values that you list look correct to me, and seem reasonable to explicitly document in the spec.
Section 18.1 lists compile-time known and local compile-time known values.
The list does not include field access with
.
and index access with[ ]
. But there are use cases in the p4c test suite that expects such.How about adding the following cases to the list in 18.1?
For a field access, accessing a field of a local compile-time known / compile-time known expression results in a local-compile time known / compile-time known value, respectively.