Skip to content

[Sema] Allow non-escaping functions to be passed as subscript arguments #12671

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

Previously, subscript arguments weren't specifically checked with checkNoEscapeParameterUse, thereby preventing non-escaping functions from being passed as arguments to them. This PR adds that check.

Fixes SR-6229.

(First-time contributing, so any and all feedback especially welcome!)

@hamishknight hamishknight force-pushed the subscript-non-escaping-args branch from 04605ed to 7061b91 Compare October 29, 2017 22:33
@slavapestov slavapestov requested a review from rjmccall October 30, 2017 06:00
@@ -373,6 +381,18 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
}
}

static void visitIndices(SubscriptExpr *subscript,
llvm::function_ref<void(unsigned, Expr*)> fn) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks; fixed.

@slavapestov
Copy link
Contributor

@swift-ci Please smoke test

@rjmccall
Copy link
Contributor

rjmccall commented Nov 2, 2017

What Slava said, but otherwise LGTM.

@hamishknight hamishknight force-pushed the subscript-non-escaping-args branch from 7061b91 to d734631 Compare November 2, 2017 11:05
@slavapestov
Copy link
Contributor

@swift-ci Please smoke test

1 similar comment
@slavapestov
Copy link
Contributor

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 759a9ee into swiftlang:master Nov 3, 2017
@hamishknight hamishknight deleted the subscript-non-escaping-args branch November 3, 2017 20:31
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