Skip to content
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

[code-completion] Disable diagnostics during code completion and fix regressions #26888

Conversation

nathawes
Copy link
Contributor

This is just @rintaro's PR to disable diagnostics and merge diagnostic suppression mechanisms (#24842) but with additional fixes for cases the stress tester found where it regressed the completion results (the two test cases in test/IDE/complete_in_closures.swift).

It changed the completion results because AST mutations were being made while diagnosing, and these are no longer happening. On top of Rintaro's changes, this PR 1) changes expression type checking for code completion to allow unresolved types when solving so we get a solution and apply the types it did manage to resolve in more cases, and 2) fixes a parsing issue where we would sometimes drop a ternary expression completely if the code completion point was in its true branch.

Resolves rdar://problem/50679428

@nathawes nathawes requested review from xedin and rintaro August 27, 2019 23:26
@nathawes
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 91553b531b573ad4e8c8e79758fc187e8a2f1364

@nathawes
Copy link
Contributor Author

@swift-ci please test OS X Platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 91553b531b573ad4e8c8e79758fc187e8a2f1364

@nathawes
Copy link
Contributor Author

@swift-ci please test OS X Platform

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

Looks great!

rintaro and others added 4 commits August 30, 2019 15:25
It seems disabling diagnstics doesn't introduce any regression.

rdar://problem/50679428
TypeCheckExprFlags::SuppressDiagnostics is now done by
DiagnosticSuppression.
…ics in code completion

There were some changes to completion results because AST mutations that were
made while diagnosing are no longer happening.

This patch 1) changes expression type checking to allow unresolved types when
solving constraint systems, so we get a solution and apply its types in more
cases, and 2) fixes a parsing issue where we would drop a ternary expression
completely if the code completion point was in its true branch.
@nathawes nathawes force-pushed the pr-disable-diagnostics-for-code-completion-2 branch from 91553b5 to feb48a6 Compare August 30, 2019 22:26
@nathawes
Copy link
Contributor Author

@swift-ci please test and merge

@nathawes
Copy link
Contributor Author

@swift-ci test and merge

@swift-ci swift-ci merged commit ed0d5dd into swiftlang:master Aug 31, 2019
@nathawes nathawes deleted the pr-disable-diagnostics-for-code-completion-2 branch September 3, 2019 17:11
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.

4 participants