[flang] Implement conditional expressions parser/semantics (F2023)#186489
Merged
[flang] Implement conditional expressions parser/semantics (F2023)#186489
Conversation
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.
Implement Fortran 2023 Conditional Expressions (R1002)
This PR contains the implementation for parsing and semantic analysis. Lowering is implemented in a separate PR (#186490)
Implements Fortran 2023 conditional expressions with syntax:
result = (condition ? value1 : condition2 ? value2 : ... : elseValue)Issue: #176999
Discourse: https://discourse.llvm.org/t/rfc-adding-conditional-expressions-in-flang-f2023/89869/1 -- note that some of the details provided in the RFC post are no longer accurate
Implementation Details
Parser:
Semantics:
LIT Testing:
Limitations
Examples
AI Usage Disclosure: AI tools (Claude Sonnet 4.5) were used to assist with implementation of this feature and test code generation. I have reviewed, modified, and tested all AI-generated code.