Skip to content

Commit 6d7c519

Browse files
committed
[mypyc] Improve error message for multiple inheritance.
mypyc/mypyc#962
1 parent c246a52 commit 6d7c519

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mypyc/irbuild/prepare.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,12 @@ def prepare_class_def(
301301
# Set up the parent class
302302
bases = [mapper.type_to_ir[base.type] for base in info.bases if base.type in mapper.type_to_ir]
303303
if not all(c.is_trait for c in bases[1:]):
304-
errors.error("Non-trait bases must appear first in parent list", path, cdef.line)
304+
errors.error(
305+
"Multiple inheritance is not currently supported (except for traits)."
306+
" Ref: https://mypyc.rtfd.io/en/latest/native_classes.html#inheritance",
307+
path,
308+
cdef.line,
309+
)
305310
ir.traits = [c for c in bases if c.is_trait]
306311

307312
mro = []

0 commit comments

Comments
 (0)