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

explicit withFilter calls are being converted to filter calls #2700

Closed
scabug opened this issue Nov 24, 2009 · 2 comments
Closed

explicit withFilter calls are being converted to filter calls #2700

scabug opened this issue Nov 24, 2009 · 2 comments

Comments

@scabug
Copy link

scabug commented Nov 24, 2009

I understand that when compiling guards in for comprehensions, filter will be called if withFilter is not defined.

Unfortunately, it seems that explicit calls to withFilter are also being transformed to calls of filter.

          def empty = Iterator.range(0, 10).
                       withFilter(isEven _).
                       withFilter(isOdd _)
warning: `withFilter' method does not yet exist on Iterator,
using `filter' method instead

IMHO a compiler error should be reported instead.

@scabug
Copy link
Author

scabug commented Nov 24, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2700?orig=1
Reporter: Eric Willigers (ewilligers)

@scabug
Copy link
Author

scabug commented Dec 1, 2009

@odersky said:
I know it's not really the right thing to do, but:

  1. This is a temporary measure. For Scala 2.8.1, the filter idiom will be deprecated
    in for comprehensions and for Scala 2.9 it will be removed.

  2. The warning is not so bad.

So I don't think this warrants the effort spent to fix this (thsi effirt would be considerable; we'd have to re-rig the parser and type checker to treat for comprehensions as being different from their expansion.

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

2 participants