Repository navigation
Fix trait conformance crash when workspace has partial signature diagnostics - #340
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an uncaught
std::out_of_range(unordered_map::at: key not found) abort inkalandra,kalandra-check, andkalandra-lspwhen any function signature in a single-file or multi-module workspace emits a diagnostic while another function exercises trait conformances.Root Cause
Checker::run()previously leftgenericRegistryReady_ = falsewheneverregisterSignatures()produced any diagnostic (becausevalidateTraitImplementations()was skipped when!diagnostics_.empty()).editorOnlyanalysis still proceeded, causingrequireConformance()to return declaration-only conformances with an emptyconformance->methodsmap and abort atconformance->methods.at(...)across trait method calls, trait function values,Display(format),Equal(==/!=), and custom arithmetic operators.Changes
genericRegistryReady_ = trueunconditionally afterregisterSignatures()inSemantics.cppso valid trait conformances upgrade to full method bindings during body/LSP checking even when an unrelated signature fails.conformance->methodslookups (TraitChecking.h,GenericProjections.h,ArithmeticChecking.h, andDisplay/EqualinSemantics.cpp) with.find(...)instead of.at(...).specializeFunctionandspecializeRecordlookups returnstd::nulloptwhen an earlier specialization failed signature or field population.GenericsTests.cpp,RecoveryTests.cpp, andRecoveryProtocolTests.py.Verification
ctest --test-dir build/native --output-on-failure -j8 -R '^(frontend-generics-(debug|sanitized)|native-lsp-recovery(-protocol)?-(debug|sanitized)|native-lsp-(debug|sanitized))$'(8/8 passed)