Skip to content

[NFC] Drop some unnecesary interface type forcing #27326

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
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ calculateTypeRelationForDecl(const Decl *D, Type ExpectedType,
bool UseFuncResultType = true) {
auto VD = dyn_cast<ValueDecl>(D);
auto DC = D->getDeclContext();
if (!VD || !VD->hasInterfaceType())
if (!VD || !VD->getInterfaceType())
return CodeCompletionResult::ExpectedTypeRelation::Unrelated;

if (auto FD = dyn_cast<AbstractFunctionDecl>(VD)) {
Expand Down Expand Up @@ -2431,7 +2431,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
addTypeAnnotation(Builder, AFT->getResult());
};

if (!AFD || !AFD->hasInterfaceType() ||
if (!AFD || !AFD->getInterfaceType() ||
!AFD->getInterfaceType()->is<AnyFunctionType>()) {
// Probably, calling closure type expression.
foundFunction(AFT);
Expand Down Expand Up @@ -2792,8 +2792,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
setClangDeclKeywords(TAD, Pairs, Builder);
addLeadingDot(Builder);
Builder.addTextChunk(TAD->getName().str());
if (TAD->hasInterfaceType()) {
auto underlyingType = TAD->getUnderlyingType();
if (auto underlyingType = TAD->getUnderlyingType()) {
if (underlyingType->hasError()) {
Type parentType;
if (auto nominal = TAD->getDeclContext()->getSelfNominalTypeDecl()) {
Expand Down Expand Up @@ -3143,9 +3142,6 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {

bool handleEnumElement(ValueDecl *D, DeclVisibilityKind Reason,
DynamicLookupInfo dynamicLookupInfo) {
// FIXME(InterfaceTypeRequest): Remove this.
(void)D->getInterfaceType();

if (auto *EED = dyn_cast<EnumElementDecl>(D)) {
addEnumElementRef(EED, Reason, dynamicLookupInfo,
/*HasTypeContext=*/true);
Expand All @@ -3154,8 +3150,6 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
llvm::DenseSet<EnumElementDecl *> Elements;
ED->getAllElements(Elements);
for (auto *Ele : Elements) {
// FIXME(InterfaceTypeRequest): Remove this.
(void)Ele->getInterfaceType();
addEnumElementRef(Ele, Reason, dynamicLookupInfo,
/*HasTypeContext=*/true);
}
Expand Down Expand Up @@ -4329,9 +4323,6 @@ class CompletionOverrideLookup : public swift::VisibleDeclConsumer {
(D->isStatic() && D->getAttrs().hasAttribute<HasInitialValueAttr>()))
return;

// FIXME(InterfaceTypeRequest): Remove this.
(void)D->getInterfaceType();

bool hasIntroducer = hasFuncIntroducer ||
hasVarIntroducer ||
hasTypealiasIntroducer;
Expand Down
9 changes: 1 addition & 8 deletions lib/Sema/CSApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1740,9 +1740,6 @@ namespace {
return nullptr;
}

// FIXME(InterfaceTypeRequest): Remove this.
(void)fn->getInterfaceType();

// Form a reference to the function. The bridging operations are generic,
// so we need to form substitutions and compute the resulting type.
auto genericSig = fn->getGenericSignature();
Expand Down Expand Up @@ -1921,14 +1918,12 @@ namespace {
auto maxFloatTypeDecl = tc.Context.get_MaxBuiltinFloatTypeDecl();

if (!maxFloatTypeDecl ||
!maxFloatTypeDecl->hasInterfaceType() ||
!maxFloatTypeDecl->getInterfaceType() ||
!maxFloatTypeDecl->getDeclaredInterfaceType()->is<BuiltinFloatType>()) {
tc.diagnose(expr->getLoc(), diag::no_MaxBuiltinFloatType_found);
return nullptr;
}

// FIXME(InterfaceTypeRequest): Remove this.
(void)maxFloatTypeDecl->getInterfaceType();
auto maxType = maxFloatTypeDecl->getUnderlyingType();

DeclName initName(tc.Context, DeclBaseName::createConstructor(),
Expand Down Expand Up @@ -4118,8 +4113,6 @@ namespace {
assert(method && "Didn't find a method?");

// The declaration we found must be exposed to Objective-C.
// FIXME(InterfaceTypeRequest): Remove this.
(void)method->getInterfaceType();
if (!method->isObjC()) {
// If the method declaration lies in a protocol and we're providing
// a default implementation of the method through a protocol extension
Expand Down
5 changes: 0 additions & 5 deletions lib/Sema/DerivedConformanceRawRepresentable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,6 @@ static bool canSynthesizeRawRepresentable(DerivedConformance &derived) {
auto enumDecl = cast<EnumDecl>(derived.Nominal);
auto &tc = derived.TC;

// Validate the enum and its raw type.
// FIXME(InterfaceTypeRequest): Remove this.
(void)enumDecl->getInterfaceType();

// It must have a valid raw type.
Type rawType = enumDecl->getRawType();
if (!rawType)
return false;
Expand Down
3 changes: 0 additions & 3 deletions lib/Sema/LookupVisibleDecls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ static bool isDeclVisibleInLookupMode(ValueDecl *Member, LookupState LS,
// Accessors are never visible directly in the source language.
if (isa<AccessorDecl>(Member))
return false;

// FIXME(InterfaceTypeRequest): Remove this.
(void)Member->getInterfaceType();

// Check access when relevant.
if (!Member->getDeclContext()->isLocalContext() &&
Expand Down
3 changes: 0 additions & 3 deletions lib/Sema/TypeCheckSwitchStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1423,9 +1423,6 @@ namespace {
}
case PatternKind::EnumElement: {
auto *VP = cast<EnumElementPattern>(item);
// FIXME(InterfaceTypeRequest): Remove this.
(void)item->getType()->getEnumOrBoundGenericEnum()->getInterfaceType();

auto *SP = VP->getSubPattern();
if (!SP) {
// If there's no sub-pattern then there's no further recursive
Expand Down