Sourcery
Sourcery copied to clipboard
'Any' Type Issue
After updating Sourcery to new version, I found that one of my template is failing I found commit which broke it: 7153768c655c5e2435323cd08f01ed8b2d13f765 https://github.com/krzysztofzablocki/Sourcery/pull/1345
Part of the template:
{% for decodeType in types.all where decodeType.directory|contains:argument.targetName and (decodeType.kind == "struct" or decodeType.kind == "class") and (decodeType|based:"Codable" or decodeType|based:"Decodable" ) and decodeType.annotations.DISABLED_FAILED_TESTS == nil %}
As I understand the problem, @art-divin you added new type 'Any', but which does not support some properties, like directory which is nil and filtering of nil throws the error: decodeType.directory|contains:argument.targetName
I don't know if it's really issue or WAD, anyway my local fix is to check kind for 'struct+class' earlier than directory, but maybe we should have some guards, e.g. resolving filter of nil should return nil earlier without deep diving and throwing the error
as you see, result is already nil, I don't see any reasons trying to filter it
WDYT about it