Skip to content

Do not use coll which is a protected member #1881

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

Merged
merged 1 commit into from
Jan 14, 2021
Merged

Conversation

exoego
Copy link
Contributor

@exoego exoego commented Jan 3, 2021

In Scala 2.13.0 and 2.13.4,

The below will not compile

  def lazyMap[T, U](coll: Iterable[T], f: T => U): Iterable[U] = new Iterable[U] {
    def iterator: Iterator[U] = coll.iterator map f
  }

The argument coll is shadowed by the protected member of Iterable trait.
Ref. https://github.com/scala/scala/blob/1851c5d637e55c8af786f428bddc9758a44c583c/src/library/scala/collection/Iterable.scala#L34

@SethTisue SethTisue merged commit 5599069 into scala:master Jan 14, 2021
@SethTisue
Copy link
Member

thank you!

@exoego exoego deleted the patch-2 branch January 14, 2021 05:05
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.

3 participants