-
Notifications
You must be signed in to change notification settings - Fork 1.1k
inline match over Option[String] not accept None as scrutinee #14245
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
Comments
Where we used to say, "full disclosure", we now say "transparent inline." Without much experience, this seems expected to me. Also, the elimination of closures ought to be called "disclosure". |
slightly minimized:
|
It has supposed to work in April 2021. But yes, expectations can change over time. |
…Scala2 added @Experimenta annotation to new API method modified message, according to review Update library/src/scala/quoted/Quotes.scala Co-authored-by: Nicolas Stucki <[email protected]> settings -> XmacroSettings added CompilationInfo.XmacroSettings to MiMaFilters corrected MiMaFilters added examples from scala#12039 with workarround against scala#14245 Co-authored-by: David Barri <[email protected]>
I likely have the same or less experience with inline semantics, but this doesn't seem expected to me, given the explicit type annotation on Is that not how inlining works in general? I.e. is this a match-specific bug? |
…Scala2 added @Experimenta annotation to new API method modified message, according to review Update library/src/scala/quoted/Quotes.scala Co-authored-by: Nicolas Stucki <[email protected]> settings -> XmacroSettings added CompilationInfo.XmacroSettings to MiMaFilters corrected MiMaFilters added examples from scala#12039 with workarround against scala#14245 Co-authored-by: David Barri <[email protected]> remove trailing '\n' from file
…Scala2 added @Experimenta annotation to new API method modified message, according to review Update library/src/scala/quoted/Quotes.scala settings -> XmacroSettings added CompilationInfo.XmacroSettings to MiMaFilters corrected MiMaFilters added examples from scala#12039 with workarround against scala#14245 remove trailing '\n' from file Co-authored-by: David Barri <[email protected]> Co-authored-by: Nicolas Stucki <[email protected]>
Inline match can only work on the static type of an expression, not its actual "code", so an |
I'm interested what that would even mean and what the design implications are. |
Ah ok, so this is right to not compile, it just doesn't compile for an accidental reason (the scrutinee binding type mismatches) rather than the real reason (you can't statically reduce an Option in that inline match). |
One question left -- why did the original pull request (#12039) passes all tests. So, the inline match was able to statically reduce an Option a few months ago? |
Perhaps because there envGet is transparent, so using the RHS static type rather than the get static type is expected. |
yes, that was it... (Hmm, but port without macros still not possible, because compiletime.error now want constant literal). |
Compiler version
Master on state of Tue Jan 11 00:12:54 EET 2022
Minimized code
Output
Expectation
should be compiled.
The text was updated successfully, but these errors were encountered: