Skip to content

Preliminary SILGen and IRGen support for nested generic types #3064

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 5 commits into from
Jun 23, 2016

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jun 19, 2016

Not quite ready, please don't merge.

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov force-pushed the nested-generic-types branch from 897f916 to 8fda275 Compare June 19, 2016 03:36
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov force-pushed the nested-generic-types branch 3 times, most recently from 59f0bc1 to e974196 Compare June 23, 2016 05:56
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

Change the 'G' mangling to include generic parameters from
all levels of nested nominal types, and not just the innermost.

Note that the raw mangling syntax is something like this for
a nested type 'A<Int>.B<String>':

- bound_generic
  - struct 'B'
    - struct 'A'
      - module 'M'
  - args
    - Int
  - args
    - String

However, the actual mangling tree is more along the lines of:

- bound_generic_struct 'B'
  - bound_generic_struct 'A'
    - module 'M'
    - args
      - Int
  - args
    - String

This arrangement improves the quality of substitutions (we are
more likely to have a substitution for the entire unbound
generic type name 'A.B' around), and simplifies a few other
details.

Unfortunately, the remangling logic becomes slightly grotesque.

A simple SILGen test for nested generics exercises the mangling,
and ensures that Sema and SILGen do not crash with nested generics.

More detailed SILGen tests, as well as IRGen support for nested
generics is next.
For now, just run the existing SILGen test to completion. I'll work on
more tests later, I wanted to check this stuff in before it bitrots
any further.
@slavapestov slavapestov force-pushed the nested-generic-types branch from e974196 to cdc0b77 Compare June 23, 2016 07:01
@slavapestov
Copy link
Contributor Author

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 3d7017a into swiftlang:master Jun 23, 2016
@slavapestov slavapestov deleted the nested-generic-types branch June 23, 2016 17:33
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.

2 participants