Skip to content

Commit b2b1d8d

Browse files
committed
Fix type mixups of ra_index() and ra_term()
This is a cosmetic change since the dialyzer isn't smart enough yet to notice the mixup. With the addition of nominal types in OTP 28 though we will eventually be able to get the dialyzer to notice this. Note that in practice `#request_vote_rpc{}` and `#pre_vote_rpc{}` are being constructed correctly with `ra_term()`s in these fields, so this isn't a bug fix.
1 parent 739c4aa commit b2b1d8d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/ra.hrl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
{term :: ra_term(),
136136
candidate_id :: ra_server_id(),
137137
last_log_index :: ra_index(),
138-
last_log_term :: ra_index()}).
138+
last_log_term :: ra_term()}).
139139

140140
%% Section 4.2
141141
-record(request_vote_result,
@@ -151,7 +151,7 @@
151151
token :: reference(),
152152
candidate_id :: ra_server_id(),
153153
last_log_index :: ra_index(),
154-
last_log_term :: ra_index()}).
154+
last_log_term :: ra_term()}).
155155

156156
-record(pre_vote_result,
157157
{term :: ra_term(),

test/ra_log_memory.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
-record(state, {last_index = 0 :: ra_index(),
4747
last_written = {0, 0} :: ra_idxterm(), % only here to fake the async api of the file based one
4848
entries = #{0 => {0, undefined}} ::
49-
#{ra_term() => {ra_index(), term()}},
49+
#{ra_index() => {ra_term(), term()}},
5050
meta = #{} :: ra_log_memory_meta(),
5151
snapshot :: option({ra_snapshot:meta(), term()})}).
5252

0 commit comments

Comments
 (0)