Added patterns for initialization for Scala #2297

(cherry-picked from e2aa3b5)