The issue-0176 conformance gate was name-only, so an impl P for T with a mismatched return/param type (or arity) built a wrong-ABI thunk that silently miscompiled (exit 0, wrong value). firstUnimplementedMethod now validates arity (after self), each param type, and the return type against the protocol declaration, substituting protocol Self->concrete via resolveProtoTypeSubSelf (recurses through pointer/many-pointer/ optional/slice/array so []Self<->[]T match; conservative .unresolved for Self-in-generic-arg). Comparison is by structural formatTypeName (alias/module/spelling independent); typesClearlyDiffer skips when either side has an unresolved leaf at any depth, biasing against false-positives. Regressions: diagnostics/1201 (negative), protocols/0420 (positive, []Self param). Verified by 3+3 adversarial reviews (a mid-fix []Self false-positive was found and closed); suite 792/0.
6 lines
439 B
Plaintext
6 lines
439 B
Plaintext
error: 'T' does not implement protocol 'P': method 'val' has a mismatched signature — return type: protocol declares 'i64', impl declares 'bool' (a protocol-method impl must match the protocol's declared types exactly, with `Self` written as `T`)
|
|
--> examples/diagnostics/1201-diagnostics-protocol-impl-signature-mismatch.sx:20:3
|
|
|
|
|
20 | p : P = t; // <- 'T' does not implement 'P' (return type)
|
|
| ^^^^^^^^^^
|