@@ -1125,41 +1125,18 @@ deriveBodyHashable_hashValue(AbstractFunctionDecl *hashValueDecl, void *) {
1125
1125
1126
1126
// return _hashValue(for: self)
1127
1127
auto *hashFunc = C.getHashValueForDecl ();
1128
- if (!hashFunc->hasInterfaceType ())
1129
- C.getLazyResolver ()->resolveDeclSignature (hashFunc);
1130
-
1131
- auto selfType = hashValueDecl->mapTypeIntoContext (
1132
- parentDC->getSelfInterfaceType ());
1133
- auto hashableProto = C.getProtocol (KnownProtocolKind::Hashable);
1134
- auto conformance = TypeChecker::conformsToProtocol (selfType, hashableProto,
1135
- parentDC, None);
1136
- auto subs = SubstitutionMap::get (hashFunc->getGenericSignature (),
1137
- ArrayRef<Type>(selfType),
1138
- ArrayRef<ProtocolConformanceRef>(*conformance));
1139
- ConcreteDeclRef hashRef (hashFunc, subs);
1140
-
1141
- auto hashExpr = new (C) DeclRefExpr (hashRef, DeclNameLoc (),
1128
+ auto hashExpr = new (C) DeclRefExpr (hashFunc, DeclNameLoc (),
1142
1129
/* implicit*/ true );
1143
-
1144
- Type intType = C.getIntDecl ()->getDeclaredType ();
1145
- hashExpr->setType (FunctionType::get (AnyFunctionType::Param (selfType),
1146
- intType));
1147
-
1148
1130
auto selfDecl = hashValueDecl->getImplicitSelfDecl ();
1149
1131
auto selfRef = new (C) DeclRefExpr (selfDecl, DeclNameLoc (),
1150
1132
/* implicit*/ true );
1151
- selfRef->setType (selfType);
1152
-
1153
- auto callExpr = CallExpr::createImplicit (C, hashExpr, { selfRef }, { });
1154
- callExpr->setType (intType);
1155
- callExpr->setThrows (false );
1156
-
1133
+ auto callExpr = CallExpr::createImplicit (C, hashExpr,
1134
+ { selfRef }, { C.Id_for });
1157
1135
auto returnStmt = new (C) ReturnStmt (SourceLoc (), callExpr);
1158
1136
1159
1137
auto body = BraceStmt::create (C, SourceLoc (), {returnStmt}, SourceLoc (),
1160
1138
/* implicit*/ true );
1161
1139
hashValueDecl->setBody (body);
1162
- hashValueDecl->setBodyTypeCheckedIfPresent ();
1163
1140
}
1164
1141
1165
1142
// / Derive a 'hashValue' implementation.
0 commit comments