Skip to content

getInterfaceType() always returns a type #28210

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 3 commits into from
Nov 12, 2019

Conversation

hamishknight
Copy link
Contributor

Remove a handful of checks for whether getInterfaceType() returns a non-null type, as it now always returns a non-null type. Also remove a couple of unnecessary calls to hasInterfaceType().

We call isInvalid() a few lines above, so the
interface type gets computed anyway.
@hamishknight hamishknight requested a review from CodaFi November 12, 2019 15:58
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@@ -1166,8 +1166,7 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
}
assert(isa<CaseStmt>(initialCaseVarDecl->getParentPatternStmt()));

if (vd->getInterfaceType() && initialCaseVarDecl->getType() &&
Copy link
Contributor

@CodaFi CodaFi Nov 12, 2019

Choose a reason for hiding this comment

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

VarDecl::getType() also computes the interface type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah nice, even more cleanup

@hamishknight
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - a7fb2d3

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

Excellent! There are various radars floating around where getInterfaceType() returns null and the caller doesn't expect it, great that they're all fixed now.

@CodaFi
Copy link
Contributor

CodaFi commented Nov 12, 2019

This picked up the libSyntax failures

@swift-ci please test macOS platform

@hamishknight hamishknight merged commit cd3ada5 into swiftlang:master Nov 12, 2019
@hamishknight hamishknight deleted the tautological-typing branch November 12, 2019 21:24
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