Skip to content

Conversation

@dan-zheng
Copy link
Contributor

Mangle @noDerivative parameters to fix type reconstruction errors.
Resolves SR-12650. The new mangling is purely additive.

Example:

$ swift-demangle --expand sS3fIedgyywd_D
Demangling for $sS3fIedgyywd_D
kind=Global
  kind=TypeMangling
    kind=Type
      kind=ImplFunctionType
        kind=ImplEscaping
        kind=ImplDifferentiable
        kind=ImplConvention, text="@callee_guaranteed"
        kind=ImplParameter
          kind=ImplConvention, text="@unowned"
          kind=ImplDifferentiability, text=""                     < new
          kind=Type
            kind=Structure
              kind=Module, text="Swift"
              kind=Identifier, text="Float"
        kind=ImplParameter
          kind=ImplConvention, text="@unowned"
          kind=ImplDifferentiability, text="@noDerivative"        < new
          kind=Type
            kind=Structure
              kind=Module, text="Swift"
              kind=Identifier, text="Float"
        kind=ImplResult
          kind=ImplConvention, text="@unowned"
          kind=Type
            kind=Structure
              kind=Module, text="Swift"
              kind=Identifier, text="Float"
$sS3fIedgyywd_D ---> @escaping @differentiable @callee_guaranteed (@unowned Swift.Float, @unowned @noDerivative Swift.Float) -> (@unowned Swift.Float)

When differentiation supports multiple result indices (TF-1250) and @noDerivative
results are added, we can reuse some of this mangling support.

Mangle `@noDerivative` parameters to fix type reconstruction errors.
Resolves SR-12650. The new mangling is purely additive.

When differentiation supports multiple result indices and `@noDerivative`
results are added, we can reuse some of this mangling support.
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

`Cihldren` -> `Children`
@dan-zheng
Copy link
Contributor Author

@swift-ci Please smoke test

@dan-zheng dan-zheng merged commit 8357c18 into swiftlang:master Apr 22, 2020
@dan-zheng dan-zheng deleted the noderivative-param-mangling branch April 22, 2020 19:38
rxwei pushed a commit to rxwei/swift that referenced this pull request Jun 3, 2020
Mangle `@noDerivative` parameters to fix type reconstruction errors.
Resolves SR-12650. The new mangling is non-breaking.

When differentiation supports multiple result indices and `@noDerivative`
results are added, we can reuse some of this mangling support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants