Copied from @retronym's fork.

https://github.com/retronym/scala/commit/374deb5c9d8573bf748440e75d9b3b6c98f707e4