You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generic functions and methods are currently skipped because their generic definition is just a template, there is no function instrumentation emitted until concrete types have been decided.
But since we use source code rewritting instead of IR rewritting for stdlib functions(see #6), it should be easy to also use source code rewritting for intercepting generic method and functions.
What about MockByName and MockMethodByName ? Still works, the name can still be referenced without any type parameter.
Are we going to support per-type parameter mock? Seems no, but we can provide type parameter infos to the user to decide the concrete type. Or, user can just type assert the receiver or arguments or results to check what actual type parameter is.
The text was updated successfully, but these errors were encountered:
Side note: for go1.20~go1.22, adding generic support is easy.
However, for go1.18 and go1.19, there is much workaround because the implementation of generic instantiation in these two versions is based on closure.
Generic functions and methods are currently skipped because their generic definition is just a template, there is no function instrumentation emitted until concrete types have been decided.
But since we use source code rewritting instead of IR rewritting for stdlib functions(see #6), it should be easy to also use source code rewritting for intercepting generic method and functions.
Generic function example:
Generic method example:
What about
MockByName
andMockMethodByName
? Still works, the name can still be referenced without any type parameter.Are we going to support per-type parameter mock? Seems no, but we can provide type parameter infos to the user to decide the concrete type. Or, user can just type assert the receiver or arguments or results to check what actual type parameter is.
The text was updated successfully, but these errors were encountered: