Skip to content

Commit 61640fe

Browse files
committed
Sema: Remove allowDerived parameter of computeAbstractTypeWitness(), which was always true
1 parent 6a24820 commit 61640fe

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

lib/Sema/TypeCheckProtocol.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,7 @@ class AssociatedTypeInference {
827827
/// Compute a type witness without using a specific potential witness,
828828
/// e.g., using a fixed type (from a refined protocol), default type
829829
/// on an associated type, or deriving the type.
830-
///
831-
/// \param allowDerived Whether to allow "derived" type witnesses.
832-
Type computeAbstractTypeWitness(AssociatedTypeDecl *assocType,
833-
bool allowDerived);
830+
Type computeAbstractTypeWitness(AssociatedTypeDecl *assocType);
834831

835832
/// Substitute the current type witnesses into the given interface type.
836833
Type substCurrentTypeWitnesses(Type type);

lib/Sema/TypeCheckProtocolInference.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,7 @@ Type AssociatedTypeInference::computeDerivedTypeWitness(
898898

899899
Type
900900
AssociatedTypeInference::computeAbstractTypeWitness(
901-
AssociatedTypeDecl *assocType,
902-
bool allowDerived) {
901+
AssociatedTypeDecl *assocType) {
903902
// We don't have a type witness for this associated type, so go
904903
// looking for more options.
905904
if (Type concreteType = computeFixedTypeWitness(assocType))
@@ -910,10 +909,8 @@ AssociatedTypeInference::computeAbstractTypeWitness(
910909
return defaultType;
911910

912911
// If we can derive a type witness, do so.
913-
if (allowDerived) {
914-
if (Type derivedType = computeDerivedTypeWitness(assocType))
915-
return derivedType;
916-
}
912+
if (Type derivedType = computeDerivedTypeWitness(assocType))
913+
return derivedType;
917914

918915
// If there is a generic parameter of the named type, use that.
919916
if (auto genericSig = dc->getGenericSignatureOfContext()) {
@@ -1197,8 +1194,7 @@ void AssociatedTypeInference::findSolutionsRec(
11971194

11981195
// Try to compute the type without the aid of a specific potential
11991196
// witness.
1200-
if (Type type = computeAbstractTypeWitness(assocType,
1201-
/*allowDerived=*/true)) {
1197+
if (Type type = computeAbstractTypeWitness(assocType)) {
12021198
if (type->hasError()) {
12031199
recordMissing();
12041200
return;

0 commit comments

Comments
 (0)