Skip to content

Commit 6d51923

Browse files
committed
Fix AutoDiff/differentiable_attr_type_checking.swift.
Previously, `ProtocolConformanceRef::getTypeWitnessByName` returned a null type. Now, it returns a dependent member type with an error base type: ``` (dependent_member_type assoc_type=Swift.(file).Differentiable.TangentVector (base=error_type (original_type=bound_generic_struct_type decl=main.(file).TF_521@tf-521.swift:1:8 (primary_archetype_type address=0x7fe08d860660 conforms_to=Swift.(file).Differentiable conforms_to=Swift.(file).FloatingPoint name=T (nested_type=Exponent <<unresolved>>) (nested_type=IntegerLiteralType <<unresolved>>) (nested_type=Magnitude <<unresolved>>) (nested_type=Stride <<unresolved>>) (nested_type=TangentVector =T))))) ``` Explicitly check whether types have error in `conformsToDifferentiable`.
1 parent 9a7c32a commit 6d51923

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2670,7 +2670,7 @@ static bool conformsToDifferentiable(Type type, DeclContext *DC) {
26702670
// Try to get the `TangentVector` type witness, in case the conformance has
26712671
// not been fully checked and the type witness cannot be resolved.
26722672
Type tanType = conf->getTypeWitnessByName(type, ctx.Id_TangentVector);
2673-
return !tanType.isNull();
2673+
return !tanType.isNull() && !tanType->hasError();
26742674
};
26752675

26762676
// SWIFT_ENABLE_TENSORFLOW

0 commit comments

Comments
 (0)