-
Marc Vertes authored
When an interpreter type implementing an interface is used by the runtime, the runtime can extract its type and create new values using reflect, and call methods on it. The problem is that there will be no interpreted method counterpart in this case, which makes wrapper panic. Allow the String() method wrapper to always succeed and return an empty string if no interpreted method is present. This allows scripts to define custom flag.Value types on which the runtime internally instantiates values using reflect (see isZeroValue in Go src/flag/flag.go). This workaround could be generalized to all wrappers if necessary. At this moment, it is convenient to keep the default behavior of expecting instantiated interpreter methods, in order to catch interpreter bugs related to interfaces. Fixes #1276.