Skip to content

Commit 8f805f5

Browse files
authored
Fix compile error in circular buffer (#280)
Fixes the following compiler error due to a recent change in V: Error: temp/circular_buffer.v:20:20: error: cannot prepend `T` to `[]T` 18 | return error('Buffer is full') 19 | } 20 | b.content.prepend(value) | ~~~~~ 21 | } 22 | Error: temp/circular_buffer.v:36:20: error: cannot prepend `T` to `[]T` 34 | } 35 | 36 | b.content.prepend(value) | ~~~~~ 37 | } 38 | checker summary: 2 V errors, 0 V warnings, 0 V notices Resolves #277.
1 parent 400f30a commit 8f805f5

File tree

1 file changed

+2
-2
lines changed
  • exercises/practice/circular-buffer/.meta

1 file changed

+2
-2
lines changed

exercises/practice/circular-buffer/.meta/example.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn (mut b CircularBuffer[T]) write(value T) ! {
1717
if b.content.len >= b.capacity {
1818
return error('Buffer is full')
1919
}
20-
b.content.prepend(value)
20+
b.content.prepend([value])
2121
}
2222

2323
pub fn (mut b CircularBuffer[T]) read() !T {
@@ -33,7 +33,7 @@ pub fn (mut b CircularBuffer[T]) overwrite(value T) {
3333
b.content.pop()
3434
}
3535

36-
b.content.prepend(value)
36+
b.content.prepend([value])
3737
}
3838

3939
pub fn (mut b CircularBuffer[T]) clear() {

0 commit comments

Comments
 (0)