Skip to content
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

Result of IndexedSeq.view is not an IndexedSeq #10103

Closed
scabug opened this issue Dec 11, 2016 · 5 comments
Closed

Result of IndexedSeq.view is not an IndexedSeq #10103

scabug opened this issue Dec 11, 2016 · 5 comments

Comments

@scabug
Copy link

scabug commented Dec 11, 2016

Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.

scala> :paste
// Entering paste mode (ctrl-D to finish)

val ints: IndexedSeq[Int] = Vector(1, 2, 3, 4)
val view: IndexedSeq[Int] = ints.view(1, 3)

// Exiting paste mode, now interpreting.

<pastie>:12: error: type mismatch;
 found   : scala.collection.SeqView[Int,IndexedSeq[Int]]
 required: IndexedSeq[Int]
       val view: IndexedSeq[Int] = ints.view(1, 3)
                                            ^

Seems like in a perfect world, a view over an IndexedSeq would be an IndexedSeq.

@scabug
Copy link
Author

scabug commented Dec 11, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10103?orig=1
Reporter: Ryan Williams (rdub)
Affected Versions: 2.12.1

@scabug
Copy link
Author

scabug commented Dec 12, 2016

@szeiger said:
The latest strawman proposals for the new collections design take this into account.

@szeiger
Copy link
Member

szeiger commented Jan 9, 2019

It's supposed to be an IndexedSeqView in 2.13 but it's actually broken:

Welcome to Scala 2.13.0-20190107-124924-eeea070 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_172).
Type in expressions for evaluation. Or try :help.

scala> val ints: IndexedSeq[Int] = Vector(1, 2, 3, 4)
ints: IndexedSeq[Int] = Vector(1, 2, 3, 4)

scala> val view: scala.collection.IndexedSeqView[Int] = ints.view(1, 3)
                                                                 ^
       error: type mismatch;
        found   : scala.collection.View[Int]
        required: scala.collection.IndexedSeqView[Int]

IndexedSeqOps has the required override. This must be a compiler bug.

@Jasper-M
Copy link
Member

Jasper-M commented Jan 9, 2019

IndexedSeqOps has the required override. This must be a compiler bug.

It doesn't. view is overriden. view(from: Int, until: Int) is not overridden and is deprecated in IterableOps.

@adriaanm adriaanm self-assigned this Jan 9, 2019
@szeiger
Copy link
Member

szeiger commented Jan 9, 2019

Oh, you're right. I'll add some overrides then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants