summaryrefslogtreecommitdiffstats
path: root/tests/language-feature
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2025-07-24 00:47:26 -0700
committerGitHub <noreply@github.com>2025-07-24 07:47:26 +0000
commit2d23a962766a97cbb11bcee5483a66aec923da49 (patch)
tree78e8475ff5f60e5a97b71a86467040c69ed56a90 /tests/language-feature
parentf78d7528fdcbd4d1825660356927ab33035377b7 (diff)
Fix confusing error messages for interface return type mismatches (#7854)
* Initial plan * Add improved diagnostic for interface return type mismatches Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Complete fix for interface return type mismatch error reporting Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Move diagnostic to synthesis phase for better interface return type mismatch errors Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Remove extraneous test file and update .gitignore Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Add diagnostic test for interface return type mismatch and apply formatting Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Address feedback: restore whitespace and use filecheck for diagnostic test Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix logic error in return type mismatch detection Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Remove unnecessary flag by using out parameter for diagnostic tracking Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Refactor witness synthesis failure reporting to use structured approach Replace ad-hoc `outSpecificDiagnosticEmitted` parameter with `WitnessSynthesisFailureReason` enum and `MethodWitnessSynthesisFailureDetails` struct as requested in code review. This provides: - Clear taxonomy of failure reasons (General, MethodResultTypeMismatch, MethodParameterMismatch) - Centralized diagnostic emission in findWitnessForInterfaceRequirement - Better extensibility for future failure types - Improved maintainability by removing state tracking flags The return type mismatch diagnostic continues to work correctly, showing error 38106 with precise location information. Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Remove unused MethodParameterMismatch enum and duplicate code Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Remove redundant requiredMethod field from MethodWitnessSynthesisFailureDetails Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Address feedback: add outFailureDetails guard and remove unnecessary hasReturnTypeError variable Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix regression: restore original diagnostic message for mutating method mismatch Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix. * Fix. * Remove `innerSink`. * Print candidates considered for interface match upon error. * Fix tests. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/language-feature')
-rw-r--r--tests/language-feature/interfaces/argument-direction-mismatch.slang4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/language-feature/interfaces/argument-direction-mismatch.slang b/tests/language-feature/interfaces/argument-direction-mismatch.slang
index cf9d99fdd..e02715ea0 100644
--- a/tests/language-feature/interfaces/argument-direction-mismatch.slang
+++ b/tests/language-feature/interfaces/argument-direction-mismatch.slang
@@ -6,11 +6,11 @@ public interface ITest {
};
public struct TestImpl : ITest {
- // CHECK: ([[# @LINE + 1]]): error 38105
+ // CHECK: ([[# @LINE + 1]]): error 38108
public void testIn(out int a) {
a = 5;
}
- // CHECK: ([[# @LINE + 1]]): error 38105
+ // CHECK: ([[# @LINE + 1]]): error 38108
public void testOut(int b) {
b = 6;
}