Skip to content

Commit 99858b7

Browse files
authored
Merge pull request #17759 from CodaFi/SILly-inputs
2 parents 003ec25 + a79c11f commit 99858b7

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

lib/SIL/SILFunctionType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2253,7 +2253,7 @@ TypeConverter::getConstantOverrideInfo(SILDeclRef derived, SILDeclRef base) {
22532253
auto overrideInterfaceFnTy = overrideInterfaceTy->castTo<FunctionType>();
22542254
overrideInterfaceTy =
22552255
GenericFunctionType::get(derivedInterfaceFnTy->getGenericSignature(),
2256-
overrideInterfaceFnTy->getInput(),
2256+
overrideInterfaceFnTy->getParams(),
22572257
overrideInterfaceFnTy->getResult(),
22582258
overrideInterfaceFnTy->getExtInfo());
22592259
}

lib/SILGen/SILGenApply.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5292,8 +5292,10 @@ emitMaterializeForSetAccessor(SILLocation loc, SILDeclRef materializeForSet,
52925292

52935293
auto origAccessType = SGM.Types.getConstantInfo(materializeForSet).FormalType;
52945294

5295-
auto origSelfType = origAccessType->getInput()
5296-
->getInOutObjectType()
5295+
assert(origAccessType->getParams().size() == 1 &&
5296+
"more than one self parameter?");
5297+
auto origSelfType = origAccessType
5298+
->getParams()[0].getPlainType()
52975299
->getCanonicalType();
52985300

52995301
CanGenericSignature genericSig;

lib/SILGen/SILGenConstructor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ static SILValue emitConstructorMetatypeArg(SILGenFunction &SGF,
3131
ValueDecl *ctor) {
3232
// In addition to the declared arguments, the constructor implicitly takes
3333
// the metatype as its first argument, like a static function.
34-
Type metatype = ctor->getInterfaceType()->castTo<AnyFunctionType>()->getInput();
34+
auto ctorFnType = ctor->getInterfaceType()->castTo<AnyFunctionType>();
35+
assert(ctorFnType->getParams().size() == 1 &&
36+
"more than one self parameter?");
37+
Type metatype = ctorFnType->getParams()[0].getType();
3538
auto *DC = ctor->getInnermostDeclContext();
3639
auto &AC = SGF.getASTContext();
3740
auto VD =

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,18 @@ static std::pair<unsigned, unsigned> getTypeDepthAndWidth(Type t) {
150150
if (auto *FnTy = t->getAs<FunctionType>()) {
151151
Depth++;
152152
unsigned MaxTypeDepth = 0;
153+
auto Params = FnTy->getParams();
154+
Width += Params.size();
155+
for (auto &Param : Params) {
156+
unsigned TypeWidth;
157+
unsigned TypeDepth;
158+
std::tie(TypeDepth, TypeWidth) = getTypeDepthAndWidth(Param.getType());
159+
if (TypeDepth > MaxTypeDepth)
160+
MaxTypeDepth = TypeDepth;
161+
Width += TypeWidth;
162+
}
153163
unsigned TypeWidth;
154164
unsigned TypeDepth;
155-
std::tie(TypeDepth, TypeWidth) = getTypeDepthAndWidth(FnTy->getInput());
156-
if (TypeDepth > MaxTypeDepth)
157-
MaxTypeDepth = TypeDepth;
158-
Width += TypeWidth;
159165
std::tie(TypeDepth, TypeWidth) = getTypeDepthAndWidth(FnTy->getResult());
160166
if (TypeDepth > MaxTypeDepth)
161167
MaxTypeDepth = TypeDepth;

0 commit comments

Comments
 (0)