Bound the variable BaseDepth out of case expression