Skip to content

[Diagnostics] Finish porting subscript errors #29065

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 4 commits into from
Jan 9, 2020

Conversation

hborla
Copy link
Member

@hborla hborla commented Jan 8, 2020

  • Diagnose subscripting a nil literal in CSGen
  • Diagnose ambiguities due to missing arguments in diagnoseAmbiguityWithFixes
  • Remove diagnoseSubscriptErrors from CSDiag

@hborla hborla requested a review from xedin January 8, 2020 05:27
@hborla
Copy link
Member Author

hborla commented Jan 8, 2020

@swift-ci please smoke test

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.

This is great, thank you!

ValueDecl *decl = nullptr;
if (expr->hasDecl()) {
decl = expr->getDecl().getDecl();
if (decl->isInvalid())
return Type();
}

if (auto nilLiteral = dyn_cast<NilLiteralExpr>(expr->getBase())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We'd have to add this similar check to both variants of addMemberRefConstraints as well which would cover other member references. In that regard maybe it makes sense to extract it into something like bool validateBaseOfMemberRef(Expr *, Diag<void>) which takes base expression and diagnostic reference?

@hborla
Copy link
Member Author

hborla commented Jan 8, 2020

@swift-ci please smoke test

@hborla hborla force-pushed the subscript-error-diag branch from 5f9086d to 301ee49 Compare January 8, 2020 21:35
@hborla
Copy link
Member Author

hborla commented Jan 8, 2020

@swift-ci please smoke test

@hborla hborla force-pushed the subscript-error-diag branch from 301ee49 to 7e05667 Compare January 8, 2020 21:36
@hborla
Copy link
Member Author

hborla commented Jan 8, 2020

@swift-ci please smoke test

@hborla hborla merged commit 9ddb5ed into swiftlang:master Jan 9, 2020
@hborla hborla deleted the subscript-error-diag branch January 9, 2020 00:05
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.

3 participants