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
CodeLiteral #484
Comments
Though a little nicer, this still doesn't solve the original problem - if you don't know the type (such as when reading from a generic annotation |
@alex2069 presumably you could write a function that takes |
I like the idea of this, but the float impl doesn't always quite work I think
|
That seems like a missing IDE warning. Java has
http://errorprone.info/bugpattern/FloatingPointLiteralPrecision.
…On Tue, Sep 3, 2019 at 11:21 PM Zac Sweers ***@***.***> wrote:
I like the idea of this, but the float impl doesn't always quite work I
think
1.00000001f.literal comes out to 1.0f
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#484?email_source=notifications&email_token=AAAQIEKIBEZOO7VB7PF5VPDQH4SR7A5CNFSM4FX6LZ32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD52GPTQ#issuecomment-527722446>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAQIELE5D5M3XU3HRARFXDQH4SR7ANCNFSM4FX6LZ3Q>
.
|
huh, TIL |
Resolves square#484 Unclear if KotlinPoet should ship with some pre-builts, but this is a good starting point at least
… On Tue, Sep 3, 2019 at 11:27 PM Zac Sweers ***@***.***> wrote:
huh, TIL
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#484?email_source=notifications&email_token=AAAQIELKWQLP2AXDKKFWSYDQH4TKRA5CNFSM4FX6LZ32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD52GYLA#issuecomment-527723564>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAQIEJ6SNWAIDEB36YANJDQH4TKRANCNFSM4FX6LZ3Q>
.
|
Another good use-case for this - we have "constantValue" |
Idea: an interface
CodeLiteral
that is used whenever we have%L
to let the value itself convert to source code.Here’s how we might define a function to convert a
Float
to aCodeLiteral
:And here’s how we might use it:
The text was updated successfully, but these errors were encountered: