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

Do not allow typedef with unspecialized generic types #1076

Merged
merged 1 commit into from
May 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions p4-16/spec/P4-16-spec.mdk
Original file line number Diff line number Diff line change
Expand Up @@ -2986,6 +2986,18 @@ The two types are treated as synonyms, and all operations that can be
executed using the original type can be also executed using the newly
created type.

If `typedef` is used with a generic type the type must be specialized
with the suitable number of type arguments:

~ Begin P4Example
struct S<T> {
T field;
}

// typedef S X; -- illegal: S does not have type arguments
typedef S<bit<32>> X; // -- legal
~ End P4Example

## Introducing new types { #sec-newtype }

Similarly to `typedef`, the keyword `type` can be used to introduce a
Expand Down