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
This is a good suggestion. I think it was already proposed multiple times. Although I believe this should not be a default behavior, we can create an official patcher (https://github.com/expr-lang/expr/tree/master/patcher) for fmt.Stringer interface.
This new patcher will automatically add .String() method calls in these cases:
All binary nodes:
foo + bar
foo in [x, y, z]
foo matches bar
Function calls in string params:
func(foo)
Anything else?
Also let's modify string() built in to add support for fmt.Stringer interface. We need this as in some caes Expr will bot be able to detect identifer type and users will need to manualy case to string.
Like in next situation, [foo, bar][0] has any type.
being able to pick fmt.Stringer or expr.Stringer (as a ExprString() interface) would be neat to opt in to behavior and differentiate behaviour if desired :)
馃憢 Hello,
I got the following error with this expression:
merge_request.state in ["merged", "closed"]
reflect.Value.MapIndex: value of type gitlab.MergeRequestState is not assignable to type string
It would be very nice if types implementing
fmt.Stringer
interface to be assignable to strings, or generally treated as strings.Alternatively, a
expr
interface types could implement, making them capable of self-casting to various scalar types.For reference this is the
gitlab.MergeRequestState
type (used inmerge_request.state
) implementationThe text was updated successfully, but these errors were encountered: