Skip to content

[ASTMangler] Add support for mangling generic typealiases. #16519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2018

Conversation

dcci
Copy link
Member

@dcci dcci commented May 11, 2018

rdar://problem/39915946

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@dcci dcci requested review from jckarter, DougGregor and eeckstein May 11, 2018 00:43
@dcci
Copy link
Member Author

dcci commented May 11, 2018

@swift-ci please test

@dcci
Copy link
Member Author

dcci commented May 11, 2018

Type reconstruction will come next, but, even with this patch alone, at least we don't crash when trying to print generic type aliases in lldb anymore :)

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 29fbf7b8cf4d7392f0a9b67dc9b0f28e9a1f43f6

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 29fbf7b8cf4d7392f0a9b67dc9b0f28e9a1f43f6

@dcci
Copy link
Member Author

dcci commented May 11, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 29fbf7b8cf4d7392f0a9b67dc9b0f28e9a1f43f6

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 29fbf7b8cf4d7392f0a9b67dc9b0f28e9a1f43f6

@DougGregor
Copy link
Member

It's a remangler failure:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -swift-version 4
21:30:35 Remangling failed:
21:30:35 original     = $Ss10DictionaryVy12PackageGraph0B22ContainerConstraintSetV10IdentifieraAE11RequirementayAEQq_AFQa_GGD
21:30:35 remangled    = $Ss10DictionaryVy12PackageGraph0B22ContainerConstraintSetV10IdentifieraAEyAEQq_AFQaG11RequirementaGD

otherwise, the changes generally look correct to be. @eeckstein is more the expert here.

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@dcci
Copy link
Member Author

dcci commented May 11, 2018

This fails on ToT

dtdebugger2:bin davide$ ./swift-demangle '$Ss10DictionaryVy12PackageGraph0B22ContainerConstraintSetV10IdentifieraAE11RequirementayAEQq_AFQa_GGD' -expand -remangle-new
Demangling for $Ss10DictionaryVy12PackageGraph0B22ContainerConstraintSetV10IdentifieraAE11RequirementayAEQq_AFQa_GGD
kind=Global
  kind=TypeMangling
    kind=Type
      kind=BoundGenericStructure
        kind=Type
          kind=Structure
            kind=Module, text="Swift"
            kind=Identifier, text="Dictionary"
        kind=TypeList
          kind=Type
            kind=TypeAlias
              kind=Structure
                kind=Module, text="PackageGraph"
                kind=Identifier, text="PackageContainerConstraintSet"
              kind=Identifier, text="Identifier"
          kind=Type
            kind=TypeAlias
              kind=BoundGenericStructure
                kind=Type
                  kind=Structure
                    kind=Module, text="PackageGraph"
                    kind=Identifier, text="PackageContainerConstraintSet"
                kind=TypeList
                  kind=Type
                    kind=AssociatedTypeRef
                      kind=QualifiedArchetype
                        kind=Number, index=0
                        kind=DeclContext
                          kind=Structure
                            kind=Module, text="PackageGraph"
                            kind=Identifier, text="PackageContainerConstraintSet"
                      kind=Identifier, text="Identifier"
              kind=Identifier, text="Requirement"
$Ss10DictionaryVy12PackageGraph0B22ContainerConstraintSetV10IdentifieraAEyAEQq_AFQaG11RequirementaGD

I guess we weren't producing that name before. I'll take a look at this.

@dcci
Copy link
Member Author

dcci commented May 11, 2018

Reduces to just:

extension DictionaryIndex {}

internal enum _VariantDictionaryBuffer<Key: Hashable, Value> {
  internal typealias Index = DictionaryIndex<Key, Value>
}

public struct Dictionary<Key: Hashable, Value> {
  internal typealias _VariantBuffer = _VariantDictionaryBuffer<Key, Value>
}

var Patatino : Dictionary<Int, Int>._VariantBuffer.Index

Looks like we need a special treatment for mangling extensions here?

@dcci dcci force-pushed the generictypealiasmangling branch from 37a424c to f665943 Compare May 11, 2018 21:35
@dcci
Copy link
Member Author

dcci commented May 11, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 37a424c8a071b9cd135076a8a59f0aa1395e2f17

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 37a424c8a071b9cd135076a8a59f0aa1395e2f17

@dcci dcci merged commit 1e5b6fe into swiftlang:master May 12, 2018
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.

4 participants