Skip to content

Fix #7204: Use evidence based type testing for unapplies #7528

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 3 commits into from
Nov 18, 2019

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Nov 9, 2019

Use evidence based type testing for unapplies. For this we currently use ClassTag but plan to replace it with a proper abstraction designed for type tests (see IsInstanceOf.scala).

  • Deprecate IsXYZ extrators
  • Provide IsInstanceOf[XYZ] evidences
  • Refine the types of arguments of unapplys
  • Use _: XYZ instead of IsXYZ(_) in the dotty library

@nicolasstucki nicolasstucki self-assigned this Nov 9, 2019
@nicolasstucki nicolasstucki force-pushed the fix-#7204 branch 3 times, most recently from 568dbec to 04527bd Compare November 11, 2019 10:19
@nicolasstucki
Copy link
Contributor Author

Blocked by #7532

@nicolasstucki nicolasstucki force-pushed the fix-#7204 branch 2 times, most recently from 26dcab9 to fe61fa2 Compare November 12, 2019 09:01
@nicolasstucki nicolasstucki force-pushed the fix-#7204 branch 2 times, most recently from 0092d92 to 1f34957 Compare November 15, 2019 18:29
@nicolasstucki nicolasstucki marked this pull request as ready for review November 15, 2019 21:04
@nicolasstucki
Copy link
Contributor Author

Roadmap after this PR:

  1. Merge this PR and get a nightly build
  2. Update reference compiler and remove all uses of IsXYZ in library/src
  3. Fix Unsound use of ClassTag.unapply #7554 and use as a replacement of the IsInstanceOf alias introduced in this PR. This will effectively test the fix for Unsound use of ClassTag.unapply #7554 on all pattern matches of TASTy reflect trees in the library and tests.
  4. After next release remove deprecated IsXYZ extractors

* Deprecate `IsXYZ` extrators
* Provide `IsInstanceOf[XYZ]` evidences
* Refine the types of arguments of `unapply`s
* Use `_: XYZ` instead of `IsXYZ(_)` in the dotty library
@nicolasstucki
Copy link
Contributor Author

Rebased

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

The new APIs will be a joy to program with 👍

@nicolasstucki nicolasstucki merged commit e215d2c into scala:master Nov 18, 2019
@nicolasstucki nicolasstucki deleted the fix-#7204 branch November 18, 2019 21:44
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