Skip to content

Commit 68c6b1a

Browse files
committed
Sema: Minor cleanups, NFC
1 parent 409af27 commit 68c6b1a

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

lib/AST/ASTContext.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2622,8 +2622,6 @@ BoundGenericType *BoundGenericType::get(NominalTypeDecl *TheDecl,
26222622
ASTContext &C = TheDecl->getDeclContext()->getASTContext();
26232623
llvm::FoldingSetNodeID ID;
26242624
RecursiveTypeProperties properties;
2625-
if (Parent)
2626-
properties |= Parent->getRecursiveProperties();
26272625
BoundGenericType::Profile(ID, TheDecl, Parent, GenericArgs, properties);
26282626

26292627
auto arena = getArena(properties);
@@ -2657,8 +2655,8 @@ BoundGenericType *BoundGenericType::get(NominalTypeDecl *TheDecl,
26572655
} else {
26582656
auto theEnum = cast<EnumDecl>(TheDecl);
26592657
newType = new (C, arena) BoundGenericEnumType(theEnum, Parent, ArgsCopy,
2660-
IsCanonical ? &C : 0,
2661-
properties);
2658+
IsCanonical ? &C : 0,
2659+
properties);
26622660
}
26632661
C.Impl.getArena(arena).BoundGenericTypes.InsertNode(newType, InsertPos);
26642662

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ void ASTPrinter::printTypeRef(Type T, const TypeDecl *RefTo, Identifier Name) {
843843
if (GP->isProtocolSelf())
844844
Context = PrintNameContext::GenericParameter;
845845
} else if (T && T->is<DynamicSelfType>()) {
846-
assert(T->getAs<DynamicSelfType>()->getSelfType()->getAnyNominal() &&
846+
assert(T->castTo<DynamicSelfType>()->getSelfType()->getAnyNominal() &&
847847
"protocol Self handled as GenericTypeParamDecl");
848848
Context = PrintNameContext::ClassDynamicSelf;
849849
}

lib/SIL/TypeLowering.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,8 @@ static Type replaceDynamicSelfWithSelf(Type t) {
18171817

18181818
/// Replace any DynamicSelf types with their underlying Self type.
18191819
static CanType replaceDynamicSelfWithSelf(CanType t) {
1820+
if (!t->hasDynamicSelfType())
1821+
return t;
18201822
return replaceDynamicSelfWithSelf(Type(t))->getCanonicalType();
18211823
}
18221824

lib/Sema/CodeSynthesis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static ParamDecl *buildArgument(SourceLoc loc, DeclContext *DC,
6767
}
6868

6969
static ParamDecl *buildLetArgument(SourceLoc loc, DeclContext *DC,
70-
StringRef name, Type type) {
70+
StringRef name, Type type) {
7171
return buildArgument(loc, DC, name, type, /*isLet*/ true);
7272
}
7373

@@ -182,8 +182,8 @@ static FuncDecl *createSetterPrototype(AbstractStorageDecl *storage,
182182
// Add a "(value : T, indices...)" argument list.
183183
auto storageType = getTypeOfStorage(storage, TC);
184184
valueDecl = buildLetArgument(storage->getLoc(),
185-
storage->getDeclContext(), "value",
186-
storageType);
185+
storage->getDeclContext(), "value",
186+
storageType);
187187
params.push_back(buildIndexForwardingParamList(storage, valueDecl));
188188

189189
Type setterRetTy = TupleType::getEmpty(TC.Context);

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,6 @@ void TypeChecker::configureInterfaceType(AbstractFunctionDecl *func) {
641641

642642
auto info = applyFunctionTypeAttributes(func, i);
643643

644-
// FIXME: We shouldn't even get here if the function isn't locally generic
645-
// to begin with, but fixing that requires a lot of reengineering for local
646-
// definitions in generic contexts.
647644
if (sig && i == e-1) {
648645
funcTy = GenericFunctionType::get(sig, argTy, funcTy, info);
649646
if (initFuncTy)

0 commit comments

Comments
 (0)