Closed naamaamir closed 1 month ago
The main problem in your code is that Multimap<function(!Match)>
is nonsense since Multimap
is not declared with @template
. The compiler should probably have a warning for using template paramaters for non-template types (it was impossible when generics were first added since there were so many spurious/incorrect usages, but now that's it's been there for years, this may be feasible).
But Dimitris is right that the "correct" solution would be to add the @template
. This should be possible, but goog.structs
and goog.labs.structs
are both basically in maintenance mode, since we are working on a cleaner and more coherent collections library. If you want to try to add the generics and properly type the methods, feel free to send a PR.
(Also note that the !
in !string
and !function
are redundant - the compiler already assumes these lower-case types are non-nullable.)
Hi,
I have this multimap with callback functions. When I compile I get "expressions are not callable" error.
Code example:
The get method returns
Array<*>
instead ofArray<!function(!Match)>
. I understand that generics should be used. I opened this issue to closure-compiler: https://github.com/google/closure-compiler/issues/2151 But I was redirected to the closure-library.Thanks!