fix #867 bug inferring type arguments for max{}