Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Any' Type Issue #1348

Open
pavel-trafimuk opened this issue Jul 17, 2024 · 0 comments
Open

'Any' Type Issue #1348

pavel-trafimuk opened this issue Jul 17, 2024 · 0 comments

Comments

@pavel-trafimuk
Copy link
Contributor

After updating Sourcery to new version, I found that one of my template is failing
I found commit which broke it: 7153768 #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 %}

Zrzut ekranu 2024-07-16 o 14 23 42

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

Zrzut ekranu 2024-07-17 o 11 10 27

as you see, result is already nil, I don't see any reasons trying to filter it

WDYT about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant