Adjust Custom FromExpr[Option[A]] for Scala 3.8#355
Merged
kitlangton merged 1 commit intokitlangton:mainfrom Oct 24, 2025
Merged
Adjust Custom FromExpr[Option[A]] for Scala 3.8#355kitlangton merged 1 commit intokitlangton:mainfrom
kitlangton merged 1 commit intokitlangton:mainfrom
Conversation
This was referenced Oct 19, 2025
Owner
|
Thanks, @WojciechMazur! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tweak to custom implementation of
FromExpr[Option[A]]to make it compile under Scala 3.8. The type annotation is required to narrowA | Nullinto justA. Scala 3.8 would ship with standard library compiled using Scala 3 including some adjustments to signaturesIssue detected by Open Community Build - https://github.com/VirtusLab/community-build3/actions/runs/18606867633/job/53059126390
The issue is triggered because
Option.applyis now defined asdef apply[T](value: T | Null): Option[T]instead ofdef apply[T](value: T): Option[T]Based on the current upstream implementation https://github.com/scala/scala3/blame/9ff48b1629601d6c7d4f766254180d917f2c7161/library/src/scala/quoted/FromExpr.scala#L100-L112
Note: I'm not sure if the rhs should probably be
Some(Option(a)), or was a deliberate decision for this variant ofFromExpr