Issue/si 4287

This is a rework of https://github.com/scala/scala/pull/3210

review by @retronym, @densh