Skip to content

More runtime support for subclass existentials #8958

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 24, 2017

Builds upon #8876 and #8788.

  • Runtime metadata instantiation for subclass existentials
  • Scalar downcasts
  • More tests, mainly casts

Next up: dynamic casts.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov force-pushed the subclass-existentials-runtime branch from 7c1d367 to 7613d74 Compare April 25, 2017 01:42
…o the class itself

Otherwise, you can run into confusing behavior.
…ric superclass constraint

Do the same thing we do for nominal types, where if the type
contains an archetype, just mangle the unbound generic form,
since the name is just for documentation purposes in LLVM IR
dumps and does not have to be unique.

This is tested as part of an upcoming patch.
@slavapestov slavapestov force-pushed the subclass-existentials-runtime branch from 7613d74 to 31dfd65 Compare April 25, 2017 08:36
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

This handles the case where the left hand side of the cast is known
to be class-like, and the right hand side is known at compile time
to be a protocol composition type.

Note that this change results in a small optimization -- a checked
cast of a metatype known to be a class metatype to a class-constrained
existential metatype no longer has to emit an explicit check that
the source is class-constrained.

Fully dynamic casts are coming up next.
@slavapestov slavapestov force-pushed the subclass-existentials-runtime branch from 31dfd65 to e0391ca Compare April 25, 2017 09:43
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 10661df into swiftlang:master Apr 25, 2017
@gparker42
Copy link
Contributor

I suspect this breaks non-smoke tests. An unrelated PR test failed IRGen/subclass_existentials.sil on 32-bit iOS simulator: https://ci.swift.org/job/swift-PR-osx/7053/

@gparker42
Copy link
Contributor

Jordan is fixing the test in #9020.

@jrose-apple
Copy link
Contributor

Thanks for tracking down the original commit.

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