Repository navigation
[LSP-PREREQUISITE] Preserve distinct diagnostic spans and named source buffers - #677
Conversation
Design rationale: preserve reports before changing the listener APIA diagnostic collector should suppress a repeated report of the same problem without silently removing a different problem. Two small defects violated that expectation: Identity and source ownershipThe patch retains the existing string-key mechanism, substitutes the real end position, and renders the parameter array using Unsaved buffers create a related source-identity problem. Scope and compatibilityThere is no listener signature change, LSP dependency, editor integration, or runtime execution change here. This foundation can merge independently of the later listener/embedding redesign planned for 0.5.0. Review the identity repair and the new overload together because the buffer-name regression exercises the collector behavior the overload is meant to support. Validation performedAt the pinned commit below, all five new regression tests and both enabled ./gradlew :javatools:test \
--tests org.xvm.asm.ErrorDeduplicationTest \
--tests org.xvm.compiler.NamedSourceDiagnosticsTest \
--tests org.xvm.compiler.SourceTest \
spotlessCheck --rerun-tasks --no-build-cache --console=plain --quietThe regressions cover equal-start/different-end spans, the Review and validation boundaryTested commit: I1 targets |
|
My vote is simply to have a one-liner fix on line 331 and be done - no PR is needed |
|
I really need to get this in and there are things that build on this. |
|
We can revert whatever changes that may prove not to matter after the compiler lsp is up, but I would strongly encourage you to approve this and we can merge in a structured manner in isolated chunks. This has been incredibly complex, so I really emphasize that we want to go over them when the entire javatools change set is in place if you still feel they should be reverted or modified and do that as separate changes. |
|
I'm not following. How hard it is to replace with and not having to add |
|
I also believe that both tests have no value. But if you absolutely need this ASAP I can remove them later |
|
Thanks for the approval, Gene. I want to answer the design questions more concretely and explain why this is a foundation for the compiler-backed LSP. The adapter compiles the editor's current text, including unsaved changes, and carries its document identity through the compiler. This is already exercised in the working branch: ordinary compilation and cursor analysis both construct The end-position correction fixes one problem. The other two contracts are independently necessary for this use:
The tests also verify that genuinely repeated reports still collapse. They make those requirements reviewable independently of a running IDE and protect them while the larger compiler-adapter changes land. On The compatibility boundary is small: existing constructors retain their behavior; file-backed sources keep their existing naming; unnamed buffers remain unnamed; the boolean listener API and the special Your concern about realizing parameter strings is valid. The change from hashing to rendering does not establish zero additional cost, nor is rendered text a complete structural equality scheme. A future structural key could preserve the same contract with a different implementation. The dependency is on stable source identity and correct diagnostic retention, rather than on this exact constructor signature or string-key representation. We need these contracts, or an equivalent implementation, in the compiler before we can land the current compiler-backed LSP with reliable diagnostics. Keeping this repair separate lets us establish that boundary with four files and small reproductions instead of burying it inside the much larger adapter PR. It is an additive prerequisite for that work, not a requirement for existing applications to adopt the LSP or a new listener API. |
Include diagnostic end positions and rendered parameters in deduplication identities, and allow unsaved source buffers to carry distinct names. Preserve the existing listener contract. Re-extracted independently on master f442ace. All five regressions and two enabled SourceTest cases pass; three existing SourceTest cases remain disabled. SpotlessCheck passes.
e649179 to
4bfd1ca
Compare
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
Summary
Why?
How?
Sourceconstructor, with regressions for distinct buffers, spans, parameter values, and repeated identical reports.Implications
The
Source(String, String)overload is additive. File-backed source naming and the existing booleanErrorListener.logcontract remain compatible. Callers naming buffers must supply a non-null label and use distinct labels for distinct documents; naming a buffer does not read or create a file.Changes
javatools/src/main/java/org/xvm/asm/ErrorListener.java: correct the span endpoint and replace the 32-bit parameter hash in deduplication keys.javatools/src/main/java/org/xvm/compiler/Source.java: preserve a caller-supplied name for an in-memory buffer.javatools/src/test/java/org/xvm/asm/ErrorDeduplicationTest.java: three regressions for span identity, colliding hashes, and repeated identical reports.javatools/src/test/java/org/xvm/compiler/NamedSourceDiagnosticsTest.java: two regressions for named and unnamed buffers.Known follow-ups
The key still uses rendered parameter values, so this does not establish collision-free equality for arbitrary objects. A structural diagnostic-identity redesign would be a separate change.