# Buggy code
def check_compatibility(
    self, name: str, base1: TypeInfo, base2: TypeInfo, ctx: Context
) -> None:
    """Check if attribute name in base1 is compatible with base2 in multiple inheritance.

    Assume base1 comes before base2 in the MRO, and that base1 and base2 don't have
    a direct subclass relationship (i.e., the compatibility requirement only derives from
    multiple inheritance).
    """
    if name == "__init__":
        # __init__ can be incompatible -- it's a special case.
        return
    first = base1[name]
    second = base2[name]
    first_type = first.type
    if first_type is None and isinstance(first.node, FuncDef):
        first_type = self.function_type(cast(FuncDef, first.node))
    second_type = second.type
    if second_type is None and isinstance(second.node, FuncDef):
        second_type = self.function_type(cast(FuncDef, second.node))
    # TODO: What if first_type or second_type is None? What if some classes are generic?
    if isinstance(first_type, FunctionLike) and isinstance(second_type, FunctionLike):
        # Method override
        first_sig = method_type(cast(FunctionLike, first_type))
        second_sig = method_type(cast(FunctionLike, second_type))
        ok = is_subtype(first_sig, second_sig)
    else:
        ok = is_equivalent(first_type, second_type)
    if not ok:
        self.msg.base_class_definitions_incompatible(name, base1, base2, ctx)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/Users/guido/src/mypy/scripts/mypy", line 6, in <module>
main(__file__)
File "/Users/guido/src/mypy/mypy/main.py", line 49, in main
type_check_only(sources, bin_dir, options)
File "/Users/guido/src/mypy/mypy/main.py", line 92, in type_check_only
python_path=options.python_path)
File "/Users/guido/src/mypy/mypy/build.py", line 197, in build
result = manager.process(initial_states)
File "/Users/guido/src/mypy/mypy/build.py", line 379, in process
next.process()
File "/Users/guido/src/mypy/mypy/build.py", line 849, in process
self.type_checker().visit_file(self.tree, self.tree.path)
File "/Users/guido/src/mypy/mypy/checker.py", line 371, in visit_file
self.accept(d)
File "/Users/guido/src/mypy/mypy/checker.py", line 379, in accept
typ = node.accept(self)
File "/Users/guido/src/mypy/mypy/nodes.py", line 552, in accept
return visitor.visit_assignment_stmt(self)
File "/Users/guido/src/mypy/mypy/checker.py", line 953, in visit_assignment_stmt
self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None)
File "/Users/guido/src/mypy/mypy/checker.py", line 981, in check_assignment
self.infer_variable_type(inferred, lvalue, self.accept(rvalue),
File "/Users/guido/src/mypy/mypy/checker.py", line 379, in accept
typ = node.accept(self)
File "/Users/guido/src/mypy/mypy/nodes.py", line 929, in accept
return visitor.visit_member_expr(self)
File "/Users/guido/src/mypy/mypy/checker.py", line 1770, in visit_member_expr
return self.expr_checker.visit_member_expr(e)
File "/Users/guido/src/mypy/mypy/checkexpr.py", line 680, in visit_member_expr
result = self.analyze_ordinary_member_access(e, False)
File "/Users/guido/src/mypy/mypy/checkexpr.py", line 693, in analyze_ordinary_member_access
self.named_type, self.msg)
File "/Users/guido/src/mypy/mypy/checkmember.py", line 84, in analyze_member_access
result = analyze_class_attribute_access(itype, name, node, is_lvalue, builtin_type, msg)
File "/Users/guido/src/mypy/mypy/checkmember.py", line 240, in analyze_class_attribute_access
return function_type(cast(FuncBase, node.node), builtin_type('builtins.function'))
File "/Users/guido/src/mypy/mypy/nodes.py", line 1733, in function_type
if func.type:
AttributeError: 'Decorator' object has no attribute 'type'

*** INTERNAL ERROR ***

ui/common/uikit.py:64: error: Internal error -- please report a bug at https://github.com/JukkaL/mypy/issues

# Fixed code
def check_compatibility(
    self, name: str, base1: TypeInfo, base2: TypeInfo, ctx: Context
) -> None:
    """Check if attribute name in base1 is compatible with base2 in multiple inheritance.

    Assume base1 comes before base2 in the MRO, and that base1 and base2 don't have
    a direct subclass relationship (i.e., the compatibility requirement only derives from
    multiple inheritance).
    """
    if name == "__init__":
        # __init__ can be incompatible -- it's a special case.
        return
    first = base1[name]
    second = base2[name]
    first_type = first.type
    if first_type is None and isinstance(first.node, FuncDef):
        first_type = self.function_type(cast(FuncDef, first.node))
    second_type = second.type
    if second_type is None and isinstance(second.node, FuncDef):
        second_type = self.function_type(cast(FuncDef, second.node))
    # TODO: What if some classes are generic?
    if isinstance(first_type, FunctionLike) and isinstance(second_type, FunctionLike):
        # Method override
        first_sig = method_type(cast(FunctionLike, first_type))
        second_sig = method_type(cast(FunctionLike, second_type))
        ok = is_subtype(first_sig, second_sig)
    elif first_type and second_type:
        ok = is_equivalent(first_type, second_type)
    else:
        if first_type is None:
            self.msg.cannot_determine_type_in_base(name, base1.name(), ctx)
        if second_type is None:
            self.msg.cannot_determine_type_in_base(name, base2.name(), ctx)
        ok = True
    if not ok:
        self.msg.base_class_definitions_incompatible(name, base1, base2, ctx)