Skip to content

Commit

Permalink
Fix converting GrpaphQL Float values to Kotlin (#5511)
Browse files Browse the repository at this point in the history
* fix converting GrpaphQL Float values to Kotlin

* update test fixtures
  • Loading branch information
martinbonnin committed Jan 9, 2024
1 parent 990cb85 commit da59d6d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
Expand Up @@ -51,7 +51,7 @@ internal fun IrValue.codeBlock(): CodeBlock {
}

is IrFloatValue -> {
val asDouble = value.toIntOrNull()
val asDouble = value.toDoubleOrNull()
if (asDouble != null) {
// The value fits in a kotlin Double
CodeBlock.of(L, value)
Expand Down
Expand Up @@ -51,7 +51,7 @@ internal fun IrValue.codeBlock(): CodeBlock {
}

is IrFloatValue -> {
val asDouble = value.toIntOrNull()
val asDouble = value.toDoubleOrNull()
if (asDouble != null) {
// The value fits in a kotlin Double
CodeBlock.of("%L", value)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -2,11 +2,11 @@
// If you updated the codegen and test fixtures, you should commit this file too.

Test: Total LOC:
aggregate-all 197830
aggregate-kotlin-responseBased 63172
aggregate-all 197828
aggregate-kotlin-responseBased 63171
aggregate-kotlin-operationBased 40971
aggregate-kotlin-compat 0
aggregate-java-operationBased 93687
aggregate-java-operationBased 93686

java-operationBased-fragments_with_defer_and_include_directives 5590
kotlin-operationBased-fragments_with_defer_and_include_directives 3510
Expand Down Expand Up @@ -198,7 +198,7 @@ kotlin-responseBased-hero_name
kotlin-operationBased-interface_on_interface 497
kotlin-responseBased-hero_name_query_long_name 495
kotlin-responseBased-interface_always_nested 492
java-operationBased-arguments_hardcoded 489
java-operationBased-arguments_hardcoded 488
kotlin-operationBased-root_query_fragment 486
kotlin-responseBased-custom_scalar_type 484
kotlin-responseBased-variable_default_value 469
Expand Down Expand Up @@ -231,7 +231,7 @@ kotlin-operationBased-inline_fragment_simple
kotlin-responseBased-starships 384
kotlin-responseBased-java8annotation 383
kotlin-responseBased-antlr_tokens 381
kotlin-responseBased-arguments_hardcoded 372
kotlin-responseBased-arguments_hardcoded 371
kotlin-responseBased-subscriptions 371
kotlin-responseBased-enums_as_sealed 353
kotlin-responseBased-operation_id_generator 339
Expand Down

0 comments on commit da59d6d

Please sign in to comment.