constant Option is not recognised as constant value in inline if #17789
Replies: 7 comments
-
inverse to #14245 |
Beta Was this translation helpful? Give feedback.
-
In case of .isDefined is problematic:
result:
|
Beta Was this translation helpful? Give feedback.
-
Not sure, this is a bug or not ? |
Beta Was this translation helpful? Give feedback.
-
Doesn't look like a bug to me. There's no way the compiler can tell that |
Beta Was this translation helpful? Give feedback.
-
I'm not against closing this issue, but want to leave a remark just from the loving to argue:
On another side, you are right, that this is more a feature request than a bug. |
Beta Was this translation helpful? Give feedback.
-
Any kind of evaluation performed by inlining must be hardcoded in the compiler. The more we make it do, the slower it will become. On the other hand, with macros, the code is in the library (such as |
Beta Was this translation helpful? Give feedback.
-
TIL FromExpr! 😄 Sounds like a plausible feature request to me, so feel free to rehash this as a request in lampepfl/dotty-feature-requests. |
Beta Was this translation helpful? Give feedback.
-
Compiler version
current (Tue Jan 11 08:53:51 EET 2022) master
Minimized code
Output
Expectation
Should be compiled.
Beta Was this translation helpful? Give feedback.
All reactions