Skip to content

Store presence of a token in an explicit field #652

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
Aug 31, 2022

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Aug 29, 2022

We recently changed a token’s presence to be implicitly determined by whether it contains any source code. It turns out that this has two downsides:

  • We cannot synthesize missing tokens with explicitly known text, like a missing for identifier token for the @_dynamicReplacable attribute (this is the issue that I just stumbled over)
  • We cannot synthesize missing tokens with trivia (this has been an issue in the past that we have been able to work around)

@ahoppen ahoppen requested a review from rintaro August 29, 2022 17:12
kind: kind, text: "", leadingTriviaPieces: [], trailingTriviaPieces: [],
arena: arena)
kind: kind,
text: "",
Copy link
Member

Choose a reason for hiding this comment

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

Inconsistent with RawSyntax.makeMissingToken(). Should we use kind.defaultText here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did actually change that in some follow-up PR but it looks like it didn’t make it into this PR. Updated it now.

@ahoppen ahoppen force-pushed the ahoppen/token-presence branch from b6ec295 to 3f15898 Compare August 30, 2022 14:16
We recently changed a token’s presence to be implicitly determined by whether it contains any source code. It turns out that this has two downsides:
- We cannot synthesize missing tokens with explicitly known text, like a missing `for` identifier token for the `@_dynamicReplacable` attribute
- We cannot synthesize missing tokens with trivia
@ahoppen ahoppen force-pushed the ahoppen/token-presence branch from 3f15898 to 5ceea93 Compare August 31, 2022 07:17
@ahoppen
Copy link
Member Author

ahoppen commented Aug 31, 2022

@swift-ci Please test

@ahoppen ahoppen merged commit 729d676 into swiftlang:main Aug 31, 2022
@ahoppen ahoppen deleted the ahoppen/token-presence branch August 31, 2022 15:57
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