Update SourceKit for getInterfaceType() changes

This commit is contained in:
Robert Widmann
2019-09-23 16:50:19 -07:00
parent 792e1db448
commit 1233cdf596
8 changed files with 13 additions and 31 deletions

View File

@@ -333,8 +333,6 @@ deriveBodyCodingKey_init_stringValue(AbstractFunctionDecl *initDecl, void *) {
static bool canSynthesizeCodingKey(DerivedConformance &derived) {
auto enumDecl = cast<EnumDecl>(derived.Nominal);
// Validate the enum and its raw type.
// FIXME(InterfaceTypeRequest): Remove this.
(void)enumDecl->getInterfaceType();
// If the enum has a raw type (optional), it must be String or Int.
Type rawType = enumDecl->getRawType();

View File

@@ -2136,8 +2136,6 @@ static FuncDecl *findReplacedAccessor(DeclName replacedVarName,
// Filter out any accessors that won't work.
if (!results.empty()) {
auto replacementStorage = replacement->getStorage();
// FIXME(InterfaceTypeRequest): Remove this.
(void)replacementStorage->getInterfaceType();
Type replacementStorageType = getDynamicComparisonType(replacementStorage);
results.erase(std::remove_if(results.begin(), results.end(),
[&](ValueDecl *result) {
@@ -2149,8 +2147,6 @@ static FuncDecl *findReplacedAccessor(DeclName replacedVarName,
return true;
// Check for type mismatch.
// FIXME(InterfaceTypeRequest): Remove this.
(void)result->getInterfaceType();
auto resultType = getDynamicComparisonType(result);
if (!resultType->isEqual(replacementStorageType) &&
!resultType->matches(
@@ -2236,8 +2232,6 @@ findReplacedFunction(DeclName replacedFunctionName,
if (result->isStatic() != replacement->isStatic())
continue;
// FIXME(InterfaceTypeRequest): Remove this.
(void)result->getInterfaceType();
TypeMatchOptions matchMode = TypeMatchFlags::AllowABICompatible;
matchMode |= TypeMatchFlags::AllowCompatibleOpaqueTypeArchetypes;
if (result->getInterfaceType()->getCanonicalType()->matches(

View File

@@ -764,8 +764,6 @@ AssociatedTypeDecl *AssociatedTypeInference::findDefaultedAssociatedType(
TypeChecker &tc,
AssociatedTypeDecl *assocType) {
// If this associated type has a default, we're done.
// FIXME(InterfaceTypeRequest): Remove this.
(void)assocType->getInterfaceType();
if (assocType->hasDefaultDefinitionType())
return assocType;

View File

@@ -25,7 +25,7 @@ func resyncParser2() {}
// RUN: %sourcekitd-test -req=cursor -pos=4:13 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
// CHECK1: source.lang.swift.decl.var.local (4:13-4:14)
// CHECK1: c
// CHECK1: <Declaration>let c</Declaration>
// CHECK1: <Declaration>let c: <Type usr="s:14cursor_invalid1CC">C</Type></Declaration>
// CHECK1: OVERRIDES BEGIN
// CHECK1: OVERRIDES END

View File

@@ -52,7 +52,7 @@ extension CC : Prot {
var extV : Int { return 0 }
}
class SubCC : CC, Prot {}
class SubCC : CC {}
var globV2: SubCC

View File

@@ -501,13 +501,6 @@
key.usr: <usr>,
key.line: 55,
key.column: 15
},
{
key.kind: source.lang.swift.ref.protocol,
key.name: "Prot",
key.usr: <usr>,
key.line: 55,
key.column: 19
}
],
key.entities: [
@@ -532,18 +525,11 @@
key.line: 55,
key.column: 15
},
{
key.kind: source.lang.swift.ref.protocol,
key.name: "Prot",
key.usr: <usr>,
key.line: 55,
key.column: 19
},
{
key.kind: source.lang.swift.decl.function.constructor,
key.usr: <usr>,
key.line: 55,
key.column: 24,
key.column: 18,
key.is_implicit: 1,
key.related: [
{
@@ -1222,6 +1208,13 @@
}
]
},
{
key.kind: source.lang.swift.decl.function.method.instance,
key.name: "meth()",
key.usr: <usr>,
key.line: 134,
key.column: 8
},
{
key.kind: source.lang.swift.decl.class,
key.name: "CC4",

View File

@@ -533,10 +533,9 @@ static void reportRelated(ASTContext &Ctx, const Decl *D,
} else if (auto *TAD = dyn_cast<TypeAliasDecl>(D)) {
if (TAD->hasInterfaceType()) {
if (auto Ty = TAD->getDeclaredInterfaceType()) {
// If underlying type exists, report the inheritance and conformance of the
// underlying type.
auto Ty = TAD->getDeclaredInterfaceType();
if (auto NM = Ty->getAnyNominal()) {
passInherits(NM->getInherited(), Consumer);
passConforms(NM->getSatisfiedProtocolRequirements(/*Sorted=*/true),

View File

@@ -778,11 +778,11 @@ static bool passCursorInfoForDecl(SourceFile* SF,
unsigned USREnd = SS.size();
unsigned TypenameBegin = SS.size();
if (VD->hasInterfaceType()) {
if (auto vdType = VD->getInterfaceType()) {
llvm::raw_svector_ostream OS(SS);
PrintOptions Options;
Options.PrintTypeAliasUnderlyingType = true;
VD->getInterfaceType().print(OS, Options);
vdType.print(OS, Options);
}
unsigned TypenameEnd = SS.size();