Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is prototype for the interface system outlined in #6975. The most important missing thing is the parse support that would need help from someone with experience in hacking the parser.
This PR adds three functions:
add_interface
: Adds an interface to the interface table (this is what should be called from the parser)verify_interface
: Checks whether a type fulfills all interfacesisinterface
: Returns if a function belongs to an interface (this is an internal function used byshowerror
)Further, the PR modifies
showerror
to check if a function is an interface and then displays the error message.The interface implementation can be used in two different ways. Either one implements the interface and the calls
verify_interface
to directly validate that the interface is fulfilled. Or one skips the last step and still gets a nice error message.In action: