Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test expects nominal equality for struct types #182

Open
hackedy opened this issue May 12, 2020 · 4 comments
Open

test expects nominal equality for struct types #182

hackedy opened this issue May 12, 2020 · 4 comments

Comments

@hackedy
Copy link
Collaborator

hackedy commented May 12, 2020

examples/checker_tests/bad/issue2230-1-bmv2.p4
This test is enforcing nominal equality for structs, which is not how we do type equality.

@jnfoster
Copy link
Contributor

Nor how the spec says it should be done:

Section 8.13: Two structs can be compared for equality (==) or inequality (!=) only if they have the same type and all of their fields can be recursively compared for equality. Two structures are equal if and only if all their corresponding fields are equal.

@hackedy
Copy link
Collaborator Author

hackedy commented May 12, 2020

That's defining the equality of two struct values, not two struct types. The spec uses type equality often, often phrased something like "x and y must have the same type," but I don't think it ever defines it.

@jnfoster
Copy link
Contributor

Oops. You're right.

@hackedy hackedy assigned hackedy and unassigned hackedy May 12, 2020
@jafingerhut
Copy link

I created this issue on the P4_16 language spec in an attempt to cause a future version to explicitly address the issue of what "same type" means, at least for headers and structs: p4lang/p4-spec#875

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants