Skip to content

[test] Use %refactor-check-compiles in more places #38915

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

Conversation

hamishknight
Copy link
Contributor

@hamishknight hamishknight commented Aug 17, 2021

Add a hidden frontend flag -warn-on-editor-placeholder that allows %refactor-check-compiles to be more lenient with placeholders, and update a bunch of async refactoring tests to use %refactor-check-compiles in more cases.

Note the diff is best viewed without whitespace.

rdar://81830915

@hamishknight hamishknight requested a review from bnbarham August 17, 2021 22:01
Copy link
Contributor

@bnbarham bnbarham 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 doing all those!

// ERROR-BLOCK-COMMENT-NEXT: // h
// ERROR-BLOCK-COMMENT-NEXT: print("after")
// ERROR-BLOCK-COMMENT-NEXT: // i
// ERROR-BLOCK-COMMENT-NEXT: {{ }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there a newline here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because we include the trailing trivia up until the next token, but in this case the next token gets removed by the transform, leaving a stray newline. At the time, it didn't seem like a case that would come up too often, given it should only happen for trailing comments at the end of braces. Though looking at it again, it seems like it should be pretty straightforward to fix, filed rdar://82072147 to take care of it. Thanks for pointing it out!

This hidden frontend option lets us be more lax
when type-checking in the presence of editor
placeholders by treating them as holes during
constraint solving.
This allows us to test more cases that type-check
modulo placeholders.
Forward these flags to both swift-frontend and
swift-refactor.
Update a bunch of async refactoring tests to use
%refactor-check-compiles in more cases.
@hamishknight hamishknight force-pushed the refactor-evaluate-print-loop branch from c39889e to f58c62c Compare August 18, 2021 12:21
@hamishknight
Copy link
Contributor Author

@swift-ci please smoke test

@hamishknight hamishknight merged commit 7fd4406 into swiftlang:main Aug 19, 2021
@hamishknight hamishknight deleted the refactor-evaluate-print-loop branch August 19, 2021 12:21
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