Skip to content

Commit 0151aff

Browse files
committed
Merge branch 'TF-523-property-not-differentiable' of github.com:bartchr808/swift into TF-523-property-not-differentiable
2 parents d3951e0 + e79379e commit 0151aff

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,8 +2733,8 @@ ERROR(differentiable_attr_unsupported_req_kind,none,
27332733
"layout requirement are not supported by '@differentiable' attribute", ())
27342734
ERROR(differentiable_attr_class_unsupported,none,
27352735
"class members cannot be marked with '@differentiable'", ())
2736-
ERROR(differentiable_attr_stored_prop_unsupported,none,
2737-
"Stored properties cannot be marked with '@differentiable'", ())
2736+
ERROR(differentiable_attr_stored_property_unsupported,none,
2737+
"stored properties cannot be marked with '@differentiable'", ())
27382738
NOTE(protocol_witness_missing_specific_differentiable_attr,none,
27392739
"candidate is missing attribute '%0'", (StringRef))
27402740

lib/Sema/TypeCheckAttr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2888,7 +2888,8 @@ void AttributeChecker::visitDifferentiableAttr(DifferentiableAttr *attr) {
28882888
AbstractFunctionDecl *original = dyn_cast<AbstractFunctionDecl>(D);
28892889
if (auto *asd = dyn_cast<AbstractStorageDecl>(D)) {
28902890
if (asd->getImplInfo().isSimpleStored()) {
2891-
diagnoseAndRemoveAttr(attr, diag::differentiable_attr_stored_prop_unsupported);
2891+
diagnoseAndRemoveAttr(attr, diag::differentiable_attr_stored_property_unsupported);
2892+
return;
28922893
}
28932894
// When used directly on a storage decl (stored/computed property or
28942895
// subscript), the getter is currently inferred to be `@differentiable`.

test/AutoDiff/differentiating_attr_type_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func vjpConsistent(_ x: Float) -> (value: Float, pullback: (Float) -> Float) {
298298

299299
// Test usage of `@differentiable` on a stored property
300300
struct PropertyDiff : Differentiable & AdditiveArithmetic {
301-
// expected-error @+1 {{Stored properties cannot be marked with '@differentiable'}}
301+
// expected-error @+1 {{stored properties cannot be marked with '@differentiable'}}
302302
@differentiable(vjp: vjpPropertyA)
303303
var a: Float = 1
304304
typealias TangentVector = PropertyDiff

0 commit comments

Comments
 (0)