Skip to content

Preliminary SILGen support for subclass existentials (SE-0156) #8685

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Apr 11, 2017

Follow-up to #8650.

The mangling for 'XE' generalized existentials is going to change again soon. Also I need to write more detailed SILGen tests.

Up next:

  • IRGen and runtime support
  • Casts in Sema, SILGen, SILOptimizer
  • Any other necessary SILOptimizer changes
  • PrintAsObjC support
  • ClangImporter support

@slavapestov slavapestov force-pushed the subclass-existentials-silgen branch 3 times, most recently from 3d0add7 to 661047b Compare April 11, 2017 08:07
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov force-pushed the subclass-existentials-silgen branch from 661047b to 1089fa8 Compare April 11, 2017 21:58
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov force-pushed the subclass-existentials-silgen branch from 1089fa8 to de254ea Compare April 12, 2017 06:45
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

Make sure we use the right 'self' type in various places. When
calling a Self-returning class method on a subclass existential,
the following has to happen correctly:

- The existential is opened to produce an archetype with a superclass
  constraint.

- The archetype is upcast to a class type to produce the 'self'
  parameter for the call.

- The method call returns a value with the same type as the 'self'
  parameter.

- The return value is downcast to the opened archetype.

- The opened archetype is converted back to an existential.

Some SILGen tests in an upcoming patch exercise this code path.
Now that mayHaveSuperclass() is back to its old meaning, we can't
piggy-back off of it anymore and must add a new bit of logic
for class-constrained existential to superclass conversions.

Also re-organize the code a bit.
@slavapestov slavapestov force-pushed the subclass-existentials-silgen branch from de254ea to 67ec712 Compare April 12, 2017 07:07
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 374db66 into swiftlang:master Apr 12, 2017
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.

1 participant