Allow type with more than one generic arg #47
Merged
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.
I noticed that we can't use generic types with two or more arguments for the
@kind
part of theinput!
macro.This is, IIUC, bacause the comma
,
that separates generic arguments is treated as a comma that separates fields ininput!
macro, and thusread_value!
gets something like@kind Foo<Arg1
.To fix the issue, I had to special-case vec type
[...]
and tuple type(...)
inside theinput!
macro and fall-through toty
instead oftt*
, since once the whole[...]
/(..)
are matched toty
it can't be matched to[ tt* ]
/( tt* )
inread_value!
macro, it seems to me. (see: https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment )Disclaimer: I'm noob at macros, and not 100% confident with the change. Please read the change with a skeptical eye 馃檹