Skip to content

Commit 610214a

Browse files
committed
Make diagnostic more user-friendly.
1 parent 9a55217 commit 610214a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,10 @@ WARNING(autodiff_nonvaried_result_fixit,none,
493493
())
494494
// TODO(TF-1149): Remove this diagnostic.
495495
NOTE(autodiff_loadable_value_addressonly_tangent_unsupported,none,
496-
"cannot differentiate value with loadable type %0 but address-only "
497-
"'TangentVector' type %1", (Type, Type))
496+
"cannot yet differentiate value whose type %0 has a compile-time known "
497+
"size, but whose 'TangentVector' contains stored properties of unknown "
498+
"size; consider modifying %1 to use fewer generic parameters in stored "
499+
"properties", (Type, Type))
498500
NOTE(autodiff_enums_unsupported,none,
499501
"differentiating enum values is not yet supported", ())
500502
NOTE(autodiff_global_let_closure_not_differentiable,none,

test/AutoDiff/downstream/differentiation_transform_diagnostics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class C<T: Differentiable>: Differentiable {
310310
// expected-error @+1 {{function is not differentiable}}
311311
@differentiable
312312
// expected-note @+2 {{when differentiating this function definition}}
313-
// expected-note @+1 {{cannot differentiate value with loadable type 'C<T>' but address-only 'TangentVector' type 'C<τ_0_0>.TangentVector'}}
313+
// expected-note @+1 {{cannot yet differentiate value whose type 'C<T>' has a compile-time known size, but whose 'TangentVector' contains stored properties of unknown size; consider modifying 'C<τ_0_0>.TangentVector' to use fewer generic parameters in stored properties}}
314314
var stored: T
315315

316316
init(_ stored: T) {
@@ -320,7 +320,7 @@ class C<T: Differentiable>: Differentiable {
320320
// expected-error @+1 {{function is not differentiable}}
321321
@differentiable
322322
// expected-note @+2 {{when differentiating this function definition}}
323-
// expected-note @+1 {{cannot differentiate value with loadable type 'C<T>' but address-only 'TangentVector' type 'C<τ_0_0>.TangentVector'}}
323+
// expected-note @+1 {{cannot yet differentiate value whose type 'C<T>' has a compile-time known size, but whose 'TangentVector' contains stored properties of unknown size; consider modifying 'C<τ_0_0>.TangentVector' to use fewer generic parameters in stored properties}}
324324
func foo(_ x: T) -> T {
325325
stored
326326
}

0 commit comments

Comments
 (0)