Scala migration: until illegal cyclic reference