Skip to content

Dotty deviation: cannot compile GenTraversableFactory #813

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

DarkDimius
Copy link
Contributor

[info] Test dotc.tests.pos_GenTraversableFactory started
./tests/pos/GenTraversableFactory.scala:57: error: genericBuilder is not a member of GenTraversableFactory.this.Coll
    def apply(from: Coll) = from.genericBuilder[A]
                                 ^
./tests/pos/GenTraversableFactory.scala:222: error: < is not a member of T(step)
    while (if (step < zero) end < i else i < end) {
               ^
./tests/pos/GenTraversableFactory.scala:222: error: < is not a member of T(end)
    while (if (step < zero) end < i else i < end) {
                            ^
./tests/pos/GenTraversableFactory.scala:222: error: < is not a member of T
    while (if (step < zero) end < i else i < end) {
                                         ^
5 errors found

We also seem to have a minor bug somewhere: only 4 errors where reported, but total is 5 errors.

[info] Test dotc.tests.pos_GenTraversableFactory started
./tests/pos/GenTraversableFactory.scala:57: error: genericBuilder is not a member of GenTraversableFactory.this.Coll
    def apply(from: Coll) = from.genericBuilder[A]
                                 ^
./tests/pos/GenTraversableFactory.scala:222: error: < is not a member of T(step)
    while (if (step < zero) end < i else i < end) {
               ^
./tests/pos/GenTraversableFactory.scala:222: error: < is not a member of T(end)
    while (if (step < zero) end < i else i < end) {
                            ^
./tests/pos/GenTraversableFactory.scala:222: error: < is not a member of T
    while (if (step < zero) end < i else i < end) {
                                         ^
5 errors found
@DarkDimius
Copy link
Contributor Author

@odersky could you please have a look?

@odersky
Copy link
Contributor

odersky commented Oct 2, 2015

When I run this on #805 I get the first error like this:

GenTraversableFactory.scala:52: error: illegal wildcard type argument; does not correspond to type parameter of a class
class GenericCanBuildFrom[A] extends CanBuildFrom[CC[_], A, CC[A]] {
^

That explains it. We cannot do existentials over hk types. The code will have to be rewritten to compile under dotty.

@odersky odersky closed this Oct 2, 2015
@DarkDimius
Copy link
Contributor Author

@odersky, could you try compiling the file from this branch, not the file in standard library.
This file was modified to compile with dotty

@DarkDimius DarkDimius reopened this Oct 2, 2015
odersky added a commit to dotty-staging/dotty that referenced this pull request Oct 7, 2015
odersky added a commit to dotty-staging/dotty that referenced this pull request Oct 7, 2015
@odersky
Copy link
Contributor

odersky commented Oct 7, 2015

GenTraversableFactory is not legal code because it uses a hk type as the type of a parameter. This is now flagged by #821.

@DarkDimius DarkDimius closed this Oct 9, 2015
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.

2 participants