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

Include hierarchy is not supported in .swifttemplate files (the "diamond problem") #729

Open
6h4k5h498h9485gh39458h9o12um3412j34lj opened this issue Mar 6, 2019 · 0 comments
Labels

Comments

@6h4k5h498h9485gh39458h9o12um3412j34lj

I have 4 .swifttemplate files:

  • Shared contains code only
  • Generator contains code only
  • Checks contains code only
  • Output outputs to a .swift file

There is a function getProcessedTypeCount() defined in Shared
I would like to use this function both in Generator and Checks

Hence I would like a diamond-shaped include hierarchy:

  • Generator includes Shared
  • Checks includes Shared
  • Output includes both Generator and Checks

But I can't do it due to "definition conflicts with previous value" and "ambiguous use of 'getProcessedTypeCount()'" errors.

I have tried these things:

  • include Shared only in Generator"use of unresolved identifier 'getProcessedTypeCount'" error in Checks
  • include Shared neither in Generator nor in Checks, include it only in Output"use of unresolved identifier 'getProcessedTypeCount'" error

Is there an equivalent of header include guards or #pragma once in Sourcery?
Or any other workaround?
Or any plan to include this feature in future versions of Sourcery?

Automatic resolution of ambiguous symbol definitions would be nice :-)

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

No branches or pull requests

2 participants