Skip to content

Remove PolymorphicFunctionType #5935

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Nov 27, 2016

For those following along at home, this is a continuation of the work in #4849 and earlier commits like da4af64. PolymorphicFunctionType is the contextual type equivalent of GenericFunctionType, a polymorphic function signature but written in terms of archetypes. It didn't make much sense in the first place, and GenericFunctionType had a FIXME comment explaining it should replace PolymorphicFunctionType -- since 2013 :-)

There are three big pieces here:

  • Ensuring all ValueDecls have an interface type assigned, instead of getInterfaceType() punting to the contextual type if an interface type is not available
  • Ensuring getType() is not called on polymorphic declarations at all, with getInterfaceType() used everywhere instead
  • Removing the code that sets the contextual type on polymorphic declarations, which means that PolymorphicFunctionType is now dead and fully subsumed by GenericFunctionType

@slavapestov slavapestov changed the title [Not for checking] Remove polymorphic function type wip [Not for checkin] Remove polymorphic function type wip Nov 27, 2016
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov force-pushed the remove-polymorphic-function-type-wip-november-2016 branch 4 times, most recently from b827fba to fd839e2 Compare November 27, 2016 18:22
@slavapestov slavapestov changed the title [Not for checkin] Remove polymorphic function type wip [Not for checkin] Remove polymorphic function type Nov 27, 2016
@@ -0,0 +1,3 @@
// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
// REQUIRES: asserts
Copy link
Member

@DougGregor DougGregor Nov 28, 2016

Choose a reason for hiding this comment

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

doesn't require asserts any more

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

I agree that the uses of SubstitutedType are fragile. In the first case, getMemberSubstitutions() seems like a far simpler and more correct solution.

For accessibility and availability checking, maintaining proper sugar in the Type (with all of the appropriate declaration references as written) would make it far easier. Or, better yet, use the TypeRepr for these checks: then we have all of the source-location information.

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

Kinda surprised we can do this, because IIRC we haven't done anything to preclude this recursion elsewhere.

@DougGregor
Copy link
Member

I browsed through everything thus far, and it's looking great. I hadn't realized we were relying on SubstitutedType for semantics in some places, which is... a bit disturbing. Definitely some cleanup to be done there.

@slavapestov slavapestov force-pushed the remove-polymorphic-function-type-wip-november-2016 branch 2 times, most recently from 4087297 to 33da79f Compare November 28, 2016 07:47
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@slavapestov
Copy link
Contributor Author

@swift-ci Please test macOS

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test macOS

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 33da79f8524acbc4300543514b2bde18a09a7c26
Test requested by - @slavapestov

@slavapestov
Copy link
Contributor Author

@DougGregor This is now at the point where check-swift-validation passes on my Mac, however it looks like I broke something in SwiftPM, and lldb needs changes as usual. Progress :)

@slavapestov slavapestov force-pushed the remove-polymorphic-function-type-wip-november-2016 branch from 33da79f to 035dff4 Compare November 28, 2016 23:13
@slavapestov
Copy link
Contributor Author

@swift-ci Please test macOS

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 33da79f8524acbc4300543514b2bde18a09a7c26
Test requested by - @slavapestov

@slavapestov
Copy link
Contributor Author

@swift-ci Please test macOS

@slavapestov slavapestov force-pushed the remove-polymorphic-function-type-wip-november-2016 branch from 035dff4 to 78b4c9e Compare November 28, 2016 23:44
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 035dff452808df850649051f2324fbac606f7126
Test requested by - @slavapestov

@slavapestov slavapestov force-pushed the remove-polymorphic-function-type-wip-november-2016 branch from 78b4c9e to 92727d5 Compare November 29, 2016 02:12
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov slavapestov force-pushed the remove-polymorphic-function-type-wip-november-2016 branch from 92727d5 to 1809fc8 Compare November 29, 2016 10:09
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov slavapestov changed the title [Not for checkin] Remove polymorphic function type Remove PolymorphicFunctionType Nov 29, 2016
@slavapestov
Copy link
Contributor Author

@swift-ci Please test Linux

@slavapestov
Copy link
Contributor Author

@swift-ci Please test macOS

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 035dff452808df850649051f2324fbac606f7126
Test requested by - @slavapestov

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - f5757e77892c31cb843ba965fe9270da52d1a41e
Test requested by - @slavapestov

@slavapestov slavapestov merged commit 33c322f into swiftlang:master Nov 29, 2016
@DougGregor
Copy link
Member

Waahoooooooo!

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