Skip to content

[NFC] Merge ExprCleaner and ExprCleanser #11047

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
Jul 19, 2017

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Jul 19, 2017

The distinction was made between these two because of rdar://25341015,
wherein we needed a diagnostic that could detect the shadowing of
global functions by calls in protocols that don't match any
of the protocol's members.

This used to function by hoping that we had an argument tuple type lying
around after type checking. The expr cleaner would re-write that
type into the AST and we would look up based on it. Now that we write
Type() into the AST on failure, we must instead type check the
component parts of the argument themselves to form a tuple
type to make the lookup.

At the end of the day, this is a dirty hack that will go away when we have the type map stuff. In the mean time it's probably good to address structural issues like this now.

The distinction was made between these two because of rdar://25341015,
wherein we needed a diagnostic that could detect the shadowing of
global functions by calls in protocols that don't match any
of the protocol's members.

This used to function by hoping that we had an argument tuple type lying
around after type checking.  The expr cleaner would re-write that
type into the AST and we would look up based on it.  Now that we write
Type() into the AST on failure, we must instead type check the
component parts of the argument themselves to form a tuple
type to make the lookup.
@CodaFi CodaFi requested a review from rudkx July 19, 2017 01:22
@CodaFi
Copy link
Contributor Author

CodaFi commented Jul 19, 2017

@swift-ci please smoke test

@CodaFi CodaFi requested review from slavapestov and removed request for rudkx July 19, 2017 01:36
for (auto *el : argTuple->getElements()) {
ConcreteDeclRef ref = nullptr;
auto typeResult =
TC.getTypeOfExpressionWithoutApplying(el, CS.DC, ref);
Copy link
Contributor Author

@CodaFi CodaFi Jul 19, 2017

Choose a reason for hiding this comment

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

This return type doesn't make any sense... I'm not sure why this returns Optional<Type> but I have a hunch it was just left over from when @rudkx was here last. I'm going to make this return Type() on failure and see what happens.

Copy link
Contributor

Choose a reason for hiding this comment

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

getTypeOfExpressionWithoutApplying() has returned an Optional<Type> since it was introduced in 69fdca4.

@slavapestov
Copy link
Contributor

LGTM

@CodaFi
Copy link
Contributor Author

CodaFi commented Jul 19, 2017

⛵️

@CodaFi CodaFi merged commit 8249593 into swiftlang:master Jul 19, 2017
@CodaFi CodaFi deleted the who-cleans-the-cleanser branch July 19, 2017 02:34
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