-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Bip(1, 2, 3) | ||
Bip(1, 2, c @ WrappedArray(3, 4, 5): _*) | ||
class [I |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import scala.runtime.ScalaRunTime.stringOf | ||
|
||
final class ArrayOpt[T](val xs: Array[T]) extends AnyVal { | ||
def toSeq: Seq[T] = xs.toSeq | ||
def length: Int = xs.length | ||
def isEmpty = xs == null | ||
def get = xs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm guessing this change is needed because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the new Spec requires |
||
def get = this | ||
def apply(i: Int) = xs(i) | ||
def drop(i: Int): Seq[T] = xs.drop(i) | ||
} | ||
|
||
object Bip { | ||
|
@@ -44,7 +48,7 @@ object Bip { | |
object Test { | ||
def f(x: Any) = x match { | ||
case Bip(a, b, c) => s"Bip($a, $b, $c)" | ||
case Bip(a, b, c : _*) => s"Bip($a, $b, c @ ${stringOf(c)}: _*)" | ||
case Bip(a, b, c: _*) => s"Bip($a, $b, c @ ${stringOf(c)}: _*)" | ||
case _ => "" + x.getClass | ||
} | ||
|
||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 👍