AdaCore / ada_language_server

Server implementing the Microsoft Language Protocol for Ada and SPARK
GNU General Public License v3.0
239 stars 55 forks source link

[Bug]: VSCode gives error when using Ada.Numerics.Discrete_Random #1220

Closed jfuentesa closed 3 weeks ago

jfuentesa commented 3 weeks ago

Environment

Bug Summary and Reproducer

Bug Summary: "Request textDocument/semanticTokens/full failed."

Steps to reproduce: Write this code:

with ADA.NUMERICS.DISCRETE_RANDOM;

procedure TEST_ALS_ERROR is
    subtype RANDOM_VALUE_SET is INTEGER range 1 .. 255;

    package RANDOM is new ADA.NUMERICS.DISCRETE_RANDOM (RESULT_SUBTYPE => RANDOM_VALUE_SET);

    GEN : RANDOM.GENERATOR;

begin

  null;

end TEST_ALS_ERROR;

Expected behavior: No errors.

Configuration and Logs

[Trace - 9:06:57 AM] Sending notification 'textDocument/didOpen'.
[Trace - 9:06:57 AM] Sending request 'textDocument/codeAction - (891)'.
[Trace - 9:06:57 AM] Sending request 'textDocument/documentSymbol - (892)'.
[Trace - 9:06:57 AM] Sending request 'textDocument/semanticTokens/full - (893)'.
[Trace - 9:06:57 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:06:57 AM] Received response 'textDocument/codeAction - (891)' in 24ms.
[Trace - 9:06:57 AM] Received response 'textDocument/semanticTokens/full - (893)' in 62ms. Request failed: Exception: raised LANGKIT_SUPPORT.ERRORS.STALE_REFERENCE_ERROR : related unit was reparsed
Load address: 0x558e07532000
[/home/xxx/.vscode-server/extensions/adacore.ada-25.0.20241014-linux-x64/x64/linux/ada_language_server]
0x558e09d0d6de Libadalang.Analysis.Check_Safety_Net.Localalias at libadalang-analysis.adb:36610
0x558e09d56146 Libadalang.Analysis.P_Decl at libadalang-analysis.adb:24221
0x558e09402b9b Lsp.Ada_Highlighters.Highlight_Name at lsp-ada_highlighters.adb:571
0x558e0940457c Lsp.Ada_Highlighters.Highlight_Node at lsp-ada_highlighters.adb:855
0x558e095c6734 Lsp.Ada_Tokens_Full.Execute_Ada_Request at lsp-ada_tokens_full.adb:114
0x558e08840023 Lsp.Ada_Request_Jobs.Execute_Request at lsp-ada_request_jobs.adb:33
0x558e0883fdf9 Lsp.Server_Request_Jobs.Execute at lsp-server_request_jobs.adb:46
0x558e088198ff Lsp.Job_Schedulers.Process_Job at lsp-job_schedulers.adb:183
0x558e09550d4a Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:847
0x558e0b714bed system__tasking__stages__task_wrapper at ???
[/lib64/libpthread.so.0]
0x7f92638fc1d8
[/lib64/libc.so.6]
0x7f9262fbc8d1
0xfffffffffffffffe
 (-32603).
[Error - 9:06:57 AM] Request textDocument/semanticTokens/full failed.
  Message: Exception: raised LANGKIT_SUPPORT.ERRORS.STALE_REFERENCE_ERROR : related unit was reparsed
Load address: 0x558e07532000
[/home/xxx/.vscode-server/extensions/adacore.ada-25.0.20241014-linux-x64/x64/linux/ada_language_server]
0x558e09d0d6de Libadalang.Analysis.Check_Safety_Net.Localalias at libadalang-analysis.adb:36610
0x558e09d56146 Libadalang.Analysis.P_Decl at libadalang-analysis.adb:24221
0x558e09402b9b Lsp.Ada_Highlighters.Highlight_Name at lsp-ada_highlighters.adb:571
0x558e0940457c Lsp.Ada_Highlighters.Highlight_Node at lsp-ada_highlighters.adb:855
0x558e095c6734 Lsp.Ada_Tokens_Full.Execute_Ada_Request at lsp-ada_tokens_full.adb:114
0x558e08840023 Lsp.Ada_Request_Jobs.Execute_Request at lsp-ada_request_jobs.adb:33
0x558e0883fdf9 Lsp.Server_Request_Jobs.Execute at lsp-server_request_jobs.adb:46
0x558e088198ff Lsp.Job_Schedulers.Process_Job at lsp-job_schedulers.adb:183
0x558e09550d4a Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:847
0x558e0b714bed system__tasking__stages__task_wrapper at ???
[/lib64/libpthread.so.0]
0x7f92638fc1d8
[/lib64/libc.so.6]
0x7f9262fbc8d1
0xfffffffffffffffe

  Code: -32603 
[Trace - 9:06:57 AM] Received response 'textDocument/documentSymbol - (892)' in 64ms.
[Trace - 9:06:57 AM] Sending request 'textDocument/documentSymbol - (894)'.
[Trace - 9:06:57 AM] Sending request 'textDocument/codeAction - (895)'.
[Trace - 9:06:57 AM] Received response 'textDocument/documentSymbol - (894)' in 2ms.
[Trace - 9:06:57 AM] Received response 'textDocument/codeAction - (895)' in 2ms.
[Trace - 9:06:58 AM] Sending request 'textDocument/semanticTokens/range - (896)'.
[Trace - 9:06:58 AM] Received response 'textDocument/semanticTokens/range - (896)' in 111ms. Request failed: Exception: raised LANGKIT_SUPPORT.ERRORS.STALE_REFERENCE_ERROR : related unit was reparsed
Load address: 0x558e07532000
[/home/xxx/.vscode-server/extensions/adacore.ada-25.0.20241014-linux-x64/x64/linux/ada_language_server]
0x558e09d0d6de Libadalang.Analysis.Check_Safety_Net.Localalias at libadalang-analysis.adb:36610
0x558e09d56146 Libadalang.Analysis.P_Decl at libadalang-analysis.adb:24221
0x558e09402b9b Lsp.Ada_Highlighters.Highlight_Name at lsp-ada_highlighters.adb:571
0x558e09404479 Lsp.Ada_Highlighters.Get_Tokens.Highlight_Node at lsp-ada_highlighters.adb:272
0x558e09c87ca9 Libadalang.Analysis.Traverse.Wrapper at libadalang-analysis.adb:36331
0x558e0a0b5d24 Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9031
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e09d0d08d Libadalang.Analysis.Traverse at libadalang-analysis.adb:36340
0x558e09402273 Lsp.Ada_Highlighters.Get_Tokens at lsp-ada_highlighters.adb:314
0x558e095c7aaf Lsp.Ada_Tokens_Range.Execute_Ada_Request at lsp-ada_tokens_range.adb:100
0x558e08840023 Lsp.Ada_Request_Jobs.Execute_Request at lsp-ada_request_jobs.adb:33
0x558e0883fdf9 Lsp.Server_Request_Jobs.Execute at lsp-server_request_jobs.adb:46
0x558e088198ff Lsp.Job_Schedulers.Process_Job at lsp-job_schedulers.adb:183
0x558e09550d4a Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:847
0x558e0b714bed system__tasking__stages__task_wrapper at ???
[/lib64/libpthread.so.0]
0x7f92638fc1d8
[/lib64/libc.so.6]
0x7f9262fbc8d1
0xfffffffffffffffe
 (-32603).
[Error - 9:06:58 AM] Request textDocument/semanticTokens/range failed.
  Message: Exception: raised LANGKIT_SUPPORT.ERRORS.STALE_REFERENCE_ERROR : related unit was reparsed
Load address: 0x558e07532000
[/home/xxx/.vscode-server/extensions/adacore.ada-25.0.20241014-linux-x64/x64/linux/ada_language_server]
0x558e09d0d6de Libadalang.Analysis.Check_Safety_Net.Localalias at libadalang-analysis.adb:36610
0x558e09d56146 Libadalang.Analysis.P_Decl at libadalang-analysis.adb:24221
0x558e09402b9b Lsp.Ada_Highlighters.Highlight_Name at lsp-ada_highlighters.adb:571
0x558e09404479 Lsp.Ada_Highlighters.Get_Tokens.Highlight_Node at lsp-ada_highlighters.adb:272
0x558e09c87ca9 Libadalang.Analysis.Traverse.Wrapper at libadalang-analysis.adb:36331
0x558e0a0b5d24 Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9031
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e0a0b5dde Libadalang.Implementation.Traverse.Localalias at libadalang-implementation.adb:9043
0x558e09d0d08d Libadalang.Analysis.Traverse at libadalang-analysis.adb:36340
0x558e09402273 Lsp.Ada_Highlighters.Get_Tokens at lsp-ada_highlighters.adb:314
0x558e095c7aaf Lsp.Ada_Tokens_Range.Execute_Ada_Request at lsp-ada_tokens_range.adb:100
0x558e08840023 Lsp.Ada_Request_Jobs.Execute_Request at lsp-ada_request_jobs.adb:33
0x558e0883fdf9 Lsp.Server_Request_Jobs.Execute at lsp-server_request_jobs.adb:46
0x558e088198ff Lsp.Job_Schedulers.Process_Job at lsp-job_schedulers.adb:183
0x558e09550d4a Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:847
0x558e0b714bed system__tasking__stages__task_wrapper at ???
[/lib64/libpthread.so.0]
0x7f92638fc1d8
[/lib64/libc.so.6]
0x7f9262fbc8d1
0xfffffffffffffffe

  Code: -32603 


### Other VS Code Extensions

_No response_

### Additional context

_No response_
reznikmm commented 3 weeks ago

Duplicate of https://github.com/AdaCore/ada_language_server/issues/1219