Skip to content

Fix FlagValueType.fromFlagType: map Long to Int and Float to Double#111

Closed
EtaCassiopeia wants to merge 1 commit into
mainfrom
fix/flag-value-type-long-float-mapping
Closed

Fix FlagValueType.fromFlagType: map Long to Int and Float to Double#111
EtaCassiopeia wants to merge 1 commit into
mainfrom
fix/flag-value-type-long-float-mapping

Conversation

@EtaCassiopeia
Copy link
Copy Markdown
Owner

Summary

Hooks that filter by supportedFlagTypes (spec 4.4.2.1) currently miss Long and Float evaluations because FlagValueType.fromFlagType falls them through to Object. Long is integral (same family as Int) and Float is fractional (same family as Double), so they should map accordingly.

Changes

  • core/src/main/scala-3/zio/openfeature/FlagValueType.scala: add Long → Int, Float → Double cases
  • core/src/main/scala-2/zio/openfeature/FlagValueType.scala: same, for cross-build
  • core/src/test/scala/zio/openfeature/HookSpec.scala: two new tests pinning the mapping

Credit

Spotted in #110 by @guizmaii.

Test plan

  • All tests pass (342)
  • scalafmtCheckAll clean

@EtaCassiopeia
Copy link
Copy Markdown
Owner Author

Tested independently; closing in favor of #110.

@EtaCassiopeia EtaCassiopeia deleted the fix/flag-value-type-long-float-mapping branch May 13, 2026 01:52
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

Successfully merging this pull request may close these issues.

1 participant