Closed bubenheimer closed 6 months ago
That's strange, we should be inlining the constant value, not using the import 🤔
Yeah, we can't just re-use the imports since they may not be visible to the generated modules. We didn't actually intend to use the imports, though -- it just looks that way.
The logic for parsing those const
arguments into their raw values was just giving up too soon. As soon as it saw a String initializer for the constant ("$OTHER_CONSTANT.foo"
), it would just pass that string literal as though it's the value.
So when you see this:
@StringKey(value = "$OTHER_CONSTANT.foo")
...it's not actually a property reference without an import. It's more like a String literal where we failed to escape the dollar sign.
Anyways, the fix is up: https://github.com/square/anvil/pull/940 :)
Thank you for the prompt fix!
Code like this fails to build in 2.5.0-beta04, works in prior versions:
The build fails in this case because the generated code (below) fails to carry over the import statement for
OTHER_CONSTANT
: