summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/interfaces/mutating-impl-of-non-mutating-req.slang
Commit message (Collapse)AuthorAge
* Check mismatching method parameter direction against interface declaration. ↵Yong He2024-12-30
| | | | (#5964)
* Fix bugs related to mutating implementations of interface methods (#1461)Tim Foley2020-07-24
There are two main bug fixes here: * We were failing to diagnose when code calls a `[mutating]` method on a value that doesn't support mutation (that is an r-value instead of an l-value). * We had a bug in the synthesis logic for interface requirements where we used the *result* type of the requirement in place of each of the *parameter* types. The second bug made synthesis often produce incorrect signatures with `void` parameters. The first bug meant that even though a `[mutating]` method should not be able to satisfy a non-`[mutating]` method (and we had code to enforce this for the "exact match" case), when we go on to try and synthesize a non-`[mutating]` method that satisfies the requirement by delegating to the user-written one, it would end up succeeding, because nothing was stopping a non-`[mutating]` method from calling a `[mutating]` one. In each case this code adds a fix and a test case to confirm it.