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
zipped does not work for arrays #2673
Comments
Imported From: https://issues.scala-lang.org/browse/SI-2673?orig=1 |
@adriaanm said: BTW, I guess I shouldn't be editing TupleN.scala, but updating genprod instead... // TODO: probably loosen zip and zipped from <:< to <%<
def zip[Repr1, El1, El2, To](implicit w1: T1 <:< TraversableLike[El1, Repr1],
w2: T2 <:< Iterable[El2],
.... |
@adriaanm said: as I understand it, we currently do implicit search with type vars as type args and then solve the type vars (including the constraints the implicit search imposed), however it seems only "top-level" implicits may include typevars, the type params of transitively required implicits must be determined immediately is this accurate? could/should we change this to simply further accumulate constraints and solve at the top-level? in the meantime, I'll commit a quick fix to zipped (just use => instead of <%<) |
@adriaanm said: typing implicit with undetermined type params: List(type Repr1, type El1, type Repr2, type El2)
tree: Test.this.MyTuple2.apply[Array[Int], Array[Int]](Test.this.as, Test.this.as).zipped[Repr1, El1, Repr2, El2]
typed impl?? conformsOrViewsAs:[A,B](implicit evidence$$1: Function1[A,B]) Predef.<%<[A,B]
==> Predef.<%<.conformsOrViewsAs
with pt = Predef.<%<[Array[Int],collection.this.TraversableLike[El1,Repr1]],
wildpt = Predef.<%<[Array[Int],collection.this.TraversableLike[?,?]]
typed implicit Predef.<%<.conformsOrViewsAs:[A, B](implicit evidence$$1: Function1[A,B]) Predef.<%<[A,B],
pt = Predef.<%<[Array[Int], collection.this.TraversableLike[?,?]]
typing implicit with undetermined type params: List(type B)
tree: Predef.<%<.conformsOrViewsAs[Array[Int], B] I think it would be better if the undetermined type param test code (+predef is modified to move <:< and conforms to LowestPriorityImplicits): import scala.collection.{TraversableLike, IterableLike}
object Test {
case class MyTuple2[+T1, +T2](_1:T1, _2:T2) {
def zipped[Repr1, El1, Repr2, El2](implicit w1: T1 <%< TraversableLike[El1, Repr1], w2: T2 <%< IterableLike[El2, Repr2]): Zipped[Repr1, El1, Repr2, El2] = new Zipped[Repr1, El1, Repr2, El2](_1, _2)
class Zipped[+Repr1, +El1, +Repr2, +El2](coll1: TraversableLike[El1, Repr1], coll2: IterableLike[El2, Repr2])
}
val as = Array(1, 2, 3)
MyTuple2(as, as) zipped
} |
@adriaanm said: |
@retronym said: In this case, it just prevents the caller to zipped explicitly passing w1, w2. What am I missing? |
Over lists I can do:
But the same over arrays gives:
The text was updated successfully, but these errors were encountered: