Scala fail Scala compiler fails to infer the return type of the function when there's an explicit return statement used in the function