I use Decodable to decode a simple struct from JSON. This works by conforming to a Decodable protocol:
extension BackendServerID: Decodable {
Swift is supposed to call the most specific implementation, you can try that in a playground to confirm; so your expectation is correct.
In your case, I suspect that the issue lies in access control levels.
In this Decodable library, method func decode(_ json: Any) is declared as public, thus it's available in your tests code.
On the other hand, your own method func decode(_ string: String) doesn't seem to be public, and then is internal by default, and not accessible in your tests code.
To fix that, either import your app's framework using @testable (which makes all internal symbols available), or declare the method public.