-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Short-style NamedTuple type can't be used as generic type argument at second position #6014
Comments
This is a bit complex to implement. For example: call([] of A, {x: Int32} -> Int32) The type of the array is obviously a Proc, but look at this: call([] of A, {x: Int32}) Now the type of the array is I think we should either emove the shortcuts for tuples and named tuples. Writing Alternatively, just document that this isn't possible, and you'll have to use |
Yet another solution could be to have a different parsing depending on the position. If it's inside generic type arguments, it's obvious that Another idea is, in calls, to assume that in |
@asterite we've always had different parsing depending on the context. For type arguments, type shortcuts always work, but outside that (method bodies) pretty much never do. For example, This is a bug report about the "type" context being lost in the second argument of a generic class. |
@asterite In your example it's actually the short-style proc type that makes it more complicated because it makes the |
So you both propose that we fix it only inside generic arguments (but not after |
Oh, actually, it's a bit more complex. For example this: class Foo
property block : Int32, Int32 -> Int32
end Since So... I guess I'll just improve the parsing for when you are clearly inside generic arguments (basically inside |
That's the main issue here 👍 |
The short-style type declaration
{x: Int32, y: String}
should be equivalent and interchangable withNamedTuple(x: Int32, y: String)
. But it seems it only works as generic type argument at the first position:The text was updated successfully, but these errors were encountered: