# Buggy code
def __init__(
    self,
    arg_types: List[Type],
    arg_kinds: List[int],
    arg_names: Sequence[Optional[str]],
    ret_type: Type,
    fallback: Instance,
    name: Optional[str] = None,
    definition: Optional[SymbolNode] = None,
    variables: Optional[List[TypeVarDef]] = None,
    line: int = -1,
    column: int = -1,
    is_ellipsis_args: bool = False,
    implicit: bool = False,
    is_classmethod_class: bool = False,
    special_sig: Optional[str] = None,
    from_type_type: bool = False,
    bound_args: Optional[List[Optional[Type]]] = None,
) -> None:
    if variables is None:
        variables = []
    assert len(arg_types) == len(arg_kinds)
    assert not any(tp is None for tp in arg_types), (
        "No annotation must be Any, not None"
    )
    self.arg_types = arg_types
    self.arg_kinds = arg_kinds
    self.arg_names = list(arg_names)
    self.min_args = arg_kinds.count(ARG_POS)
    self.is_var_arg = ARG_STAR in arg_kinds
    self.is_kw_arg = ARG_STAR2 in arg_kinds
    self.ret_type = ret_type
    self.fallback = fallback
    assert not name or "<bound method" not in name
    self.name = name
    self.definition = definition
    self.variables = variables
    self.is_ellipsis_args = is_ellipsis_args
    self.implicit = implicit
    self.is_classmethod_class = is_classmethod_class
    self.special_sig = special_sig
    self.from_type_type = from_type_type
    self.bound_args = bound_args or []
    super().__init__(line, column)


# Traceback (IndexError)
Traceback (most recent call last):
File "[somewhere]/mypy/main.py", line 80, in main
type_check_only(sources, bin_dir, options, flush_errors)
File "[somewhere]/mypy/main.py", line 129, in type_check_only
flush_errors=flush_errors)
File "[somewhere]/mypy/build.py", line 172, in build
result = _build(sources, options, alt_lib_path, bin_dir, saved_cache, flush_errors)
File "[somewhere]/mypy/build.py", line 258, in _build
graph = dispatch(sources, manager)
File "[somewhere]/mypy/build.py", line 2048, in dispatch
process_graph(graph, manager)
File "[somewhere]/mypy/build.py", line 2349, in process_graph
process_stale_scc(graph, scc, manager)
File "[somewhere]/mypy/build.py", line 2525, in process_stale_scc
graph[id].type_check_first_pass()
File "[somewhere]/mypy/build.py", line 1923, in type_check_first_pass
self.type_checker().check_first_pass()
File "[somewhere]/mypy/checker.py", line 228, in check_first_pass
self.accept(d)
File "[somewhere]/mypy/checker.py", line 323, in accept
stmt.accept(self)
File "[somewhere]/mypy/nodes.py", line 701, in accept
return visitor.visit_class_def(self)
File "[somewhere]/mypy/checker.py", line 1251, in visit_class_def
self.accept(defn.defs)
File "[somewhere]/mypy/checker.py", line 323, in accept
stmt.accept(self)
File "[somewhere]/mypy/nodes.py", line 763, in accept
return visitor.visit_block(self)
File "[somewhere]/mypy/checker.py", line 1371, in visit_block
self.accept(s)
File "[somewhere]/mypy/checker.py", line 323, in accept
stmt.accept(self)
File "[somewhere]/mypy/nodes.py", line 574, in accept
return visitor.visit_decorator(self)
File "[somewhere]/mypy/checker.py", line 2537, in visit_decorator
self.check_func_item(e.func, name=e.func.name())
File "[somewhere]/mypy/checker.py", line 640, in check_func_item
self.check_func_def(defn, typ, name)
File "[somewhere]/mypy/checker.py", line 803, in check_func_def
self.accept(item.body)
File "[somewhere]/mypy/checker.py", line 323, in accept
stmt.accept(self)
File "[somewhere]/mypy/nodes.py", line 763, in accept
return visitor.visit_block(self)
File "[somewhere]/mypy/checker.py", line 1371, in visit_block
self.accept(s)
File "[somewhere]/mypy/checker.py", line 323, in accept
stmt.accept(self)
File "[somewhere]/mypy/nodes.py", line 928, in accept
return visitor.visit_if_stmt(self)
File "[somewhere]/mypy/checker.py", line 2244, in visit_if_stmt
self.accept(s.else_body)
File "...lib/python3.5/contextlib.py", line 66, in __exit__
next(self.gen)
File "[somewhere]/mypy/binder.py", line 379, in frame_context
self.pop_frame(can_skip, fall_through)
File "[somewhere]/mypy/binder.py", line 223, in pop_frame
self.last_pop_changed = self.update_from_options(options)
File "[somewhere]/mypy/binder.py", line 199, in update_from_options
type = join_simple(self.declarations[key], type, other)
File "[somewhere]/mypy/join.py", line 34, in join_simple
if is_proper_subtype(s, t):
File "[somewhere]/mypy/subtypes.py", line 835, in is_proper_subtype
return left.accept(ProperSubtypeVisitor(right))
File "[somewhere]/mypy/types.py", line 742, in accept
return visitor.visit_callable_type(self)
File "[somewhere]/mypy/subtypes.py", line 917, in visit_callable_type
use_proper_subtype=True)
File "[somewhere]/mypy/subtypes.py", line 726, in is_callable_subtype
if left_arg.pos is not None
File "[somewhere]/mypy/types.py", line 818, in argument_by_position
self.arg_kinds[position],
IndexError: list index out of range

# Fixed code
def __init__(
    self,
    arg_types: List[Type],
    arg_kinds: List[int],
    arg_names: Sequence[Optional[str]],
    ret_type: Type,
    fallback: Instance,
    name: Optional[str] = None,
    definition: Optional[SymbolNode] = None,
    variables: Optional[List[TypeVarDef]] = None,
    line: int = -1,
    column: int = -1,
    is_ellipsis_args: bool = False,
    implicit: bool = False,
    is_classmethod_class: bool = False,
    special_sig: Optional[str] = None,
    from_type_type: bool = False,
    bound_args: Optional[List[Optional[Type]]] = None,
) -> None:
    assert len(arg_types) == len(arg_kinds) == len(arg_names)
    if variables is None:
        variables = []
    assert len(arg_types) == len(arg_kinds)
    assert not any(tp is None for tp in arg_types), (
        "No annotation must be Any, not None"
    )
    self.arg_types = arg_types
    self.arg_kinds = arg_kinds
    self.arg_names = list(arg_names)
    self.min_args = arg_kinds.count(ARG_POS)
    self.is_var_arg = ARG_STAR in arg_kinds
    self.is_kw_arg = ARG_STAR2 in arg_kinds
    self.ret_type = ret_type
    self.fallback = fallback
    assert not name or "<bound method" not in name
    self.name = name
    self.definition = definition
    self.variables = variables
    self.is_ellipsis_args = is_ellipsis_args
    self.implicit = implicit
    self.is_classmethod_class = is_classmethod_class
    self.special_sig = special_sig
    self.from_type_type = from_type_type
    self.bound_args = bound_args or []
    super().__init__(line, column)