Skip to content

Commit 77c3f15

Browse files
committed
AutoDiff: Local workaround for invariant violation
1 parent a08d141 commit 77c3f15

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/SILOptimizer/Differentiation/PullbackCloner.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ class PullbackCloner::Implementation final
224224
getPullback().getLoweredFunctionType()->getSubstGenericSignature());
225225
auto remappedSILType =
226226
SILType::getPrimitiveType(remappedType, ty.getCategory());
227-
return getPullback().mapTypeIntoContext(remappedSILType);
227+
// FIXME: Sometimes getPullback() doesn't have a generic environment, in which
228+
// case callers are apparently happy to receive an interface type.
229+
if (getPullback().getGenericEnvironment())
230+
return getPullback().mapTypeIntoContext(remappedSILType);
231+
return remappedSILType;
228232
}
229233

230234
std::optional<TangentSpace> getTangentSpace(CanType type) {

0 commit comments

Comments
 (0)