merge fixes: extract typedCase to be reused in TreeChecker.