Skip to content

Conversation

@SethTisue
Copy link
Member

@SethTisue SethTisue commented Nov 21, 2020

this regressed in #9091

the problem turned up in the Scala 2.12 community build -- when Scala 3 support was added to the scala-collection-compat repo, a test case there was altered in a way that happened to tickle this

even though the bug doesn't exist in 2.13, the change to the test should be merged forward

this regressed in scala#9091

the problem turned up in the Scala 2.12 community build -- when Scala
3 support was added to the scala-collection-compat repo, a test case
there was altered in a way that happened to tickle this
@scala-jenkins scala-jenkins added this to the 2.12.14 milestone Nov 21, 2020
@SethTisue SethTisue changed the title fix regression where Array[Unit].empty caused NPE fix 2.12.13 regression where Array[Unit].empty caused NPE Nov 21, 2020
@SethTisue SethTisue changed the title fix 2.12.13 regression where Array[Unit].empty caused NPE fix never-released 2.12.13 regression where Array[Unit].empty caused NPE Nov 21, 2020
@SethTisue SethTisue requested a review from mkeskells November 21, 2020 20:20
@SethTisue SethTisue modified the milestones: 2.12.14, 2.12.13 Nov 21, 2020
@SethTisue SethTisue added prio:blocker release blocker (used only by core team, only near release time) library:collections PRs involving changes to the standard collection library labels Nov 21, 2020
@SethTisue SethTisue requested a review from retronym November 21, 2020 20:21
@SethTisue
Copy link
Member Author

SethTisue commented Nov 21, 2020

btw, 2.13 doesn't have the bug — it seems #9091 wasn't forward-ported to 2.13, as per scala/scala-dev#721, though @dwijnand also mentioned at #9206 that it “might follow in cherry-pick/forward-port PR”, not sure if that's still on a to-do list somewhere

@mkeskells
Copy link
Contributor

btw, 2.13 doesn't have the bug — it seems #9091 wasn't forward-ported to 2.13, as per scala/scala-dev#721, though @dwijnand also mentioned at #9206 that it “might follow in cherry-pick/forward-port PR”, not sure if that's still on a to-do list somewhere

its was on my TODO list (a long one)

@som-snytt
Copy link
Contributor

It came up whether to disallow Array[Nothing] and I was just looking at Array thinking it does real work to support Array[Unit] but is it useful? If you've got a map it could be foreach; maybe a parallel operation resulting in the array has Future[Array[Unit]] to mean the operation completed. Same with Future[Array[Nothing]], where the array is empty.

@SethTisue
Copy link
Member Author

SethTisue commented Nov 23, 2020

@som-snytt it's perhaps worth mentioning that it isn't just Array[Unit].empty with Unit concretely specified that fails; also generic Array[T].empty fails if T happens to be Unit. The generic scenario is of course more plausible to occur in real code.

@SethTisue SethTisue removed the prio:blocker release blocker (used only by core team, only near release time) label Nov 23, 2020
@SethTisue SethTisue merged commit aa73e74 into scala:2.12.x Nov 23, 2020
@SethTisue SethTisue deleted the fix-array-empty-unit branch November 23, 2020 02:02
@dwijnand
Copy link
Member

it seems #9091 wasn't forward-ported to 2.13, as per scala/scala-dev#721, though @dwijnand also mentioned at #9206 that it “might follow in cherry-pick/forward-port PR”, not sure if that's still on a to-do list somewhere

The order of events is reversed: in scala/scala-dev#721 I settled it that it was too time-consuming for me to cherrypick.

hamzaremmal pushed a commit to hamzaremmal/scala3 that referenced this pull request May 2, 2025
fix never-released 2.12.13 regression where Array[Unit].empty caused NPE
hamzaremmal pushed a commit to scala/scala3 that referenced this pull request May 7, 2025
fix never-released 2.12.13 regression where Array[Unit].empty caused NPE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

library:collections PRs involving changes to the standard collection library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants