Scala compiler fails to infer the return type when there's an explicit return statement