Skip to content

Fix #581: Add tests and adapt to named-base unapplySeq spec #5959

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

Closed
wants to merge 1 commit into from

Conversation

liufengyun
Copy link
Contributor

Fix #581: Add tests and adapt to named-base unapplySeq spec

def isEmpty = xs == null
def get = xs
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing this change is needed because Array[T] only defines length apply and drop after implicit conversion to ArrayWrapper, which dotty doesn't perform in that case...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the new Spec requires toSeq as well.

case TripleBippy(3 :: Nil, 3.0, 'b', chars : _*) => "1: " + chars
case TripleBippy(5 :: Nil, 5.0, 'b' | 'B', chars : _*) => "2: " + chars
case TripleBippy(_, _, chars : _*) => "3: " + chars
case TripleBippy(3 :: Nil, 3.0, Bippy('b', chars : _*)) => "1: " + chars
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently Dotty does not support TripleBippy as it's written before. I agree this is not a proper fix. We need to decide whether or not to suppor the Scala2 behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. The spec is also inconsistent as it claims to support a super set of scalac patterns.

Copy link
Member

@smarter smarter Feb 21, 2019

Choose a reason for hiding this comment

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

Note that this test was changed in scala/scala@308ae2d#diff-f761b9d2bf9ec2f17bc00f552fc07314 when Scala 2.13 changed how name-based unapplySeq works: scala/scala#7068

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the link @smarter 👍

@liufengyun
Copy link
Contributor Author

Close in favor of #5989

@liufengyun liufengyun closed this Feb 26, 2019
@liufengyun liufengyun deleted the fix-581 branch February 26, 2019 22:11
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