Skip to content

[Syntax] Make PostfixIfConfigExpr.base optional #38410

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

Merged
merged 1 commit into from
Jul 16, 2021

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jul 15, 2021

For nested #if ... #endf in postfix if-config expression, like:

  baseExpr
    #if COND1
      #if COND2
        .member
      #endif
    #endif

Consider the inner #if be a postfix if-config expression with a 'nil' base expression.

https://bugs.swift.org/browse/SR-14929
rdar://80688328

@rintaro
Copy link
Member Author

rintaro commented Jul 15, 2021

swiftlang/swift-syntax#297
@swift-ci Please smoke test

@rintaro rintaro requested review from allevato and akyrtzi July 15, 2021 19:29
Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix!

#if true
.call()
#else
#if true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth having another case where there is an intervening member access expression in the middle of two clauses, to check that the base is present in that nesting scenario? For example,

foo()
#if COND1
  .bar?()!
#elseif COND2
  #if true
    .call()
  #else
    .somethingElse
    #if true
      ...

For nested `#if ... #endf` in postfix if-config expression, like:

  baseExpr
    #if COND1
      #if COND2
        .member
      #endif
    #endif

Consider the inner `#if` be a postfix if-config with 'nil' base
expression.

https://bugs.swift.org/browse/SR-14929
@rintaro rintaro force-pushed the syntax-postfixifconfig-sr14929 branch from 3fccf51 to b455177 Compare July 15, 2021 23:38
@rintaro
Copy link
Member Author

rintaro commented Jul 15, 2021

swiftlang/swift-syntax#297
@swift-ci Please smoke test

@rintaro rintaro merged commit 0441183 into swiftlang:main Jul 16, 2021
@rintaro rintaro deleted the syntax-postfixifconfig-sr14929 branch July 16, 2021 17:25
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.

2 participants