Skip to content

Commit 11aa92a

Browse files
committed
Do not use an access type discriminant for a mutable type
... This is not allowed. To circumvent, define a local class wide access type. For https://gitlab.adacore-it.com/eng/toolchain/gnat/-/issues/993
1 parent f366015 commit 11aa92a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: liblsp_base/source/lsp-json_streams.ads

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ with VSS.Text_Streams;
2929
package LSP.JSON_Streams is
3030
-- pragma Elaborate_Body;
3131

32+
type JSON_Reader is access all VSS.JSON.Pull_Readers.JSON_Pull_Reader'Class;
33+
3234
type JSON_Stream
3335
(Is_Server_Side : Boolean := False;
34-
R : access VSS.JSON.Pull_Readers.JSON_Pull_Reader'Class := null)
36+
R : JSON_Reader := null)
3537
is limited new Ada.Streams.Root_Stream_Type with private;
3638
-- Stream implemented over JSON document
3739
--
@@ -106,7 +108,7 @@ private
106108

107109
type JSON_Stream
108110
(Is_Server_Side : Boolean := False;
109-
R : access VSS.JSON.Pull_Readers.JSON_Pull_Reader'Class := null)
111+
R : JSON_Reader := null)
110112
is limited new Ada.Streams.Root_Stream_Type with
111113
record
112114
W : Write_Stream;

Diff for: source/client/lsp-clients.adb

+1-1
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ package body LSP.Clients is
636636
use all type VSS.JSON.Streams.JSON_Stream_Element_Kind;
637637

638638
R : aliased VSS.JSON.Pull_Readers.Simple.JSON_Simple_Pull_Reader;
639-
JS : aliased LSP.JSON_Streams.JSON_Stream (False, R'Access);
639+
JS : aliased LSP.JSON_Streams.JSON_Stream (False, R'Unchecked_Access);
640640

641641
begin
642642
R.Set_Stream (Memory'Unchecked_Access);

0 commit comments

Comments
 (0)