-
-
Notifications
You must be signed in to change notification settings - Fork 418
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
Disallow named arguments for methods of a type union where parameter names differ #2194
Conversation
src/libponyc/type/lookup.c
Outdated
{ | ||
ast_free_unattached(r); | ||
ok = false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our else
block handling is wildly inconsistent throughout the codebase.
we should put together a c coding style
I think this is overly aggressive. Note that the rules discussed in the referenced ticket were:
|
From what I can tell the function lookup happens before we know that positional or named parameters are in use. Is there a way to annotate the function type AST node so that when the function call is processed we can reject it if the names are different? |
… when using named arguments. This fixes the bug noted in ponylang#394, where named parameters can be used with methods in a union type whose parameter names differ. The change makes it a compile-time error to call a method on a union type using named arguments when the methods in the union types have differently-named parameters.
b61d93e
to
9bee8c2
Compare
I have added a check for the use of named arguments before triggering a compiler error. I am not very confident given my limited knowledge of the compiler internals that this will catch all the necessary cases. |
Working on learning more about the compiler...
This fixes the bug noted in #394, where named parameters can be used with methods in a union type whose parameter names differ.
The change makes it a compile-time error to call a method on a union type using named arguments when the methods in the union types have differently-named parameters.
Was:
This fixes the bug noted in #394, where named parameters can be used with
methods in a union type whose parameter names differ.
The change makes it a compile-time error to call a method on a union type
(whether using named parameters or not) when the methods in the union types
have differently-named parameters.