# Buggy code
def visit_super_expr(self, e: SuperExpr) -> Type:
    """Type check a super expression (non-lvalue)."""

    # We have an expression like super(T, var).member

    # First compute the types of T and var
    types = self._super_arg_types(e)
    if isinstance(types, tuple):
        type_type, instance_type = types
    else:
        return types

    # Now get the MRO
    type_info = type_info_from_type(type_type)
    if type_info is None:
        self.chk.fail(message_registry.UNSUPPORTED_ARG_1_FOR_SUPER, e)
        return AnyType(TypeOfAny.from_error)

    instance_info = type_info_from_type(instance_type)
    if instance_info is None:
        self.chk.fail(message_registry.UNSUPPORTED_ARG_2_FOR_SUPER, e)
        return AnyType(TypeOfAny.from_error)

    mro = instance_info.mro

    # The base is the first MRO entry *after* type_info that has a member
    # with the right name
    try:
        index = mro.index(type_info)
    except ValueError:
        self.chk.fail(message_registry.SUPER_ARG_2_NOT_INSTANCE_OF_ARG_1, e)
        return AnyType(TypeOfAny.from_error)

    for base in mro[index + 1 :]:
        if e.name in base.names or base == mro[-1]:
            if e.info and e.info.fallback_to_any and base == mro[-1]:
                # There's an undefined base class, and we're at the end of the
                # chain.  That's not an error.
                return AnyType(TypeOfAny.special_form)

            return analyze_member_access(
                name=e.name,
                typ=instance_type,
                is_lvalue=False,
                is_super=True,
                is_operator=False,
                original_type=instance_type,
                override_info=base,
                context=e,
                msg=self.msg,
                chk=self.chk,
                in_literal_context=self.is_literal_context(),
            )

    assert False, "unreachable"


# Traceback (AssertionError)
version: 0.740+dev.fd9c1a07a984d66e35b502881aee80529c930501
Traceback (most recent call last):
File "/Users/maxchase/.pyenv/versions/structured-data/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/__main__.py", line 8, in console_entry
main(None, sys.stdout, sys.stderr)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/main.py", line 88, in main
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/build.py", line 164, in build
result = _build(sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/build.py", line 229, in _build
graph = dispatch(sources, manager, stdout)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/build.py", line 2566, in dispatch
process_graph(graph, manager)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/build.py", line 2875, in process_graph
process_stale_scc(graph, scc, manager)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/build.py", line 2974, in process_stale_scc
graph[id].type_check_first_pass()
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/build.py", line 2070, in type_check_first_pass
self.type_checker().check_first_pass()
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 289, in check_first_pass
self.accept(d)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 396, in accept
stmt.accept(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/nodes.py", line 668, in accept
return visitor.visit_func_def(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 721, in visit_func_def
self._visit_func_def(defn)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 725, in _visit_func_def
self.check_func_item(defn, name=defn.name())
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 787, in check_func_item
self.check_func_def(defn, typ, name)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 958, in check_func_def
self.accept(item.body)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 396, in accept
stmt.accept(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/nodes.py", line 992, in accept
return visitor.visit_block(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 1917, in visit_block
self.accept(s)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 396, in accept
stmt.accept(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/nodes.py", line 668, in accept
return visitor.visit_func_def(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 721, in visit_func_def
self._visit_func_def(defn)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 725, in _visit_func_def
self.check_func_item(defn, name=defn.name())
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 787, in check_func_item
self.check_func_def(defn, typ, name)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 958, in check_func_def
self.accept(item.body)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 396, in accept
stmt.accept(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/nodes.py", line 992, in accept
return visitor.visit_block(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 1917, in visit_block
self.accept(s)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 396, in accept
stmt.accept(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/nodes.py", line 1128, in accept
return visitor.visit_return_stmt(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 2940, in visit_return_stmt
self.check_return_stmt(s)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checker.py", line 2973, in check_return_stmt
s.expr, return_type, allow_none_return=allow_none_func_call))
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checkexpr.py", line 3591, in accept
typ = self.visit_call_expr(node, allow_none_return=True)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checkexpr.py", line 264, in visit_call_expr
return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checkexpr.py", line 313, in visit_call_expr_inner
callee_type = get_proper_type(self.accept(e.callee, type_context, always_allow_any=True))
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checkexpr.py", line 3595, in accept
typ = node.accept(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/nodes.py", line 1815, in accept
return visitor.visit_super_expr(self)
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/checkexpr.py", line 3322, in visit_super_expr
assert False, 'unreachable'
AssertionError: unreachable

# Fixed code
def visit_super_expr(self, e: SuperExpr) -> Type:
    """Type check a super expression (non-lvalue)."""

    # We have an expression like super(T, var).member

    # First compute the types of T and var
    types = self._super_arg_types(e)
    if isinstance(types, tuple):
        type_type, instance_type = types
    else:
        return types

    # Now get the MRO
    type_info = type_info_from_type(type_type)
    if type_info is None:
        self.chk.fail(message_registry.UNSUPPORTED_ARG_1_FOR_SUPER, e)
        return AnyType(TypeOfAny.from_error)

    instance_info = type_info_from_type(instance_type)
    if instance_info is None:
        self.chk.fail(message_registry.UNSUPPORTED_ARG_2_FOR_SUPER, e)
        return AnyType(TypeOfAny.from_error)

    mro = instance_info.mro

    # The base is the first MRO entry *after* type_info that has a member
    # with the right name
    try:
        index = mro.index(type_info)
    except ValueError:
        self.chk.fail(message_registry.SUPER_ARG_2_NOT_INSTANCE_OF_ARG_1, e)
        return AnyType(TypeOfAny.from_error)

    if len(mro) == index + 1:
        self.chk.fail(message_registry.TARGET_CLASS_HAS_NO_BASE_CLASS, e)
        return AnyType(TypeOfAny.from_error)

    for base in mro[index + 1 :]:
        if e.name in base.names or base == mro[-1]:
            if e.info and e.info.fallback_to_any and base == mro[-1]:
                # There's an undefined base class, and we're at the end of the
                # chain.  That's not an error.
                return AnyType(TypeOfAny.special_form)

            return analyze_member_access(
                name=e.name,
                typ=instance_type,
                is_lvalue=False,
                is_super=True,
                is_operator=False,
                original_type=instance_type,
                override_info=base,
                context=e,
                msg=self.msg,
                chk=self.chk,
                in_literal_context=self.is_literal_context(),
            )

    assert False, "unreachable"