Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: skip coverage check for all deprecated pub fns #1368

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions array/deprecated.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
///|
/// Create a new array. Values are lazily built.
/// @alert deprecated "Use `FixedArray::makei` instead"
/// @coverage.skip
pub fn FixedArray::new[T](length : Int, value : () -> T) -> FixedArray[T] {
if length <= 0 {
[]
Expand All @@ -30,6 +31,7 @@ pub fn FixedArray::new[T](length : Int, value : () -> T) -> FixedArray[T] {
///|
/// Create a new array. Values are built from indexes.
/// @alert deprecated "Use `FixedArray::makei` instead"
/// @coverage.skip
pub fn FixedArray::new_with_index[T](
length : Int,
value : (Int) -> T
Expand All @@ -46,6 +48,7 @@ pub fn FixedArray::new_with_index[T](
/// assert_eq!(sum, 15)
/// ```
/// @alert deprecated "Use `fold` instead"
/// @coverage.skip
pub fn fold_left[T, U](self : FixedArray[T], f : (U, T) -> U, init~ : U) -> U {
self.fold(init~, f)
}
Expand All @@ -59,6 +62,7 @@ pub fn fold_left[T, U](self : FixedArray[T], f : (U, T) -> U, init~ : U) -> U {
/// assert_eq!(sum, 15)
/// ```
/// @alert deprecated "Use `rev_fold` instead"
/// @coverage.skip
pub fn fold_right[T, U](self : FixedArray[T], f : (U, T) -> U, init~ : U) -> U {
self.rev_fold(init~, f)
}
Expand All @@ -72,6 +76,7 @@ pub fn fold_right[T, U](self : FixedArray[T], f : (U, T) -> U, init~ : U) -> U {
/// assert_eq!(sum, 10)
/// ```
/// @alert deprecated "Use `foldi` instead"
/// @coverage.skip
pub fn fold_lefti[T, U](
self : FixedArray[T],
f : (Int, U, T) -> U,
Expand All @@ -89,6 +94,7 @@ pub fn fold_lefti[T, U](
/// assert_eq!(sum, 10)
/// ```
/// @alert deprecated "Use `rev_foldi` instead"
/// @coverage.skip
pub fn fold_righti[T, U](
self : FixedArray[T],
f : (Int, U, T) -> U,
Expand Down
3 changes: 3 additions & 0 deletions buffer/deprecated.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/// Return a new string contains the data in buffer.
///
/// @alert deprecated "Use `Buffer::contents` to read the contents of the buffer"
/// @coverage.skip
pub fn to_string(self : T) -> String {
self.contents().to_unchecked_string(offset=0, length=self.len)
}
Expand All @@ -26,13 +27,15 @@ pub fn to_string(self : T) -> String {
/// it simply copy the bytes into a new String.
///
/// @alert deprecated "Use `Buffer::contents` to read the contents of the buffer"
/// @coverage.skip
pub fn to_unchecked_string(self : T) -> String {
self.contents().to_unchecked_string(offset=0, length=self.len)
}

///|
/// Write a sub-string into buffer.
/// @alert deprecated "Use `Buffer::write_substring` instead"
/// @coverage.skip
pub fn write_sub_string(
self : T,
value : String,
Expand Down
5 changes: 5 additions & 0 deletions builtin/array.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ pub fn search[T : Eq](self : Array[T], value : T) -> Int? {

///|
/// @alert deprecated "Use `search_by` instead."
/// @coverage.skip
pub fn find_index[T](self : Array[T], f : (T) -> Bool) -> Int? {
search_by(self, f)
}
Expand Down Expand Up @@ -868,6 +869,7 @@ pub fn rev_foldi[A, B](self : Array[A], init~ : B, f : (Int, B, A) -> B) -> B {
/// assert_eq!(sum, 15)
/// ```
/// @alert deprecated "Use `fold` instead."
/// @coverage.skip
pub fn fold_left[T, U](self : Array[T], f : (U, T) -> U, init~ : U) -> U {
self.fold(init~, f)
}
Expand All @@ -881,6 +883,7 @@ pub fn fold_left[T, U](self : Array[T], f : (U, T) -> U, init~ : U) -> U {
/// assert_eq!(sum, 15)
/// ```
/// @alert deprecated "Use `rev_fold` instead."
/// @coverage.skip
pub fn fold_right[T, U](self : Array[T], f : (U, T) -> U, init~ : U) -> U {
self.rev_fold(init~, f)
}
Expand All @@ -894,6 +897,7 @@ pub fn fold_right[T, U](self : Array[T], f : (U, T) -> U, init~ : U) -> U {
/// assert_eq!(sum, 10)
/// ```
/// @alert deprecated "Use `foldi` instead."
/// @coverage.skip
pub fn fold_lefti[T, U](self : Array[T], f : (Int, U, T) -> U, init~ : U) -> U {
self.foldi(init~, f)
}
Expand All @@ -907,6 +911,7 @@ pub fn fold_lefti[T, U](self : Array[T], f : (Int, U, T) -> U, init~ : U) -> U {
/// assert_eq!(sum, 10)
/// ```
/// @alert deprecated "Use `rev_foldi` instead."
/// @coverage.skip
pub fn fold_righti[T, U](self : Array[T], f : (Int, U, T) -> U, init~ : U) -> U {
self.rev_foldi(init~, f)
}
Expand Down
1 change: 1 addition & 0 deletions builtin/arraycore_js.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ pub fn pop[T](self : Array[T]) -> T? {

///|
/// @alert deprecated "Use `unsafe_pop` instead"
/// @coverage.skip
pub fn pop_exn[T](self : Array[T]) -> T {
self.unsafe_pop()
}
Expand Down
1 change: 1 addition & 0 deletions builtin/arraycore_nonjs.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ pub fn pop[T](self : Array[T]) -> T? {

///|
/// @alert deprecated "Use `unsafe_pop` instead"
/// @coverage.skip
pub fn pop_exn[T](self : Array[T]) -> T {
self.unsafe_pop()
}
Expand Down
4 changes: 4 additions & 0 deletions builtin/bigint_deprecated.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

///|
/// @alert deprecated "Use infix bitwise operator `>>` instead"
/// @coverage.skip
pub fn asr(self : BigInt, n : Int) -> BigInt {
self >> n
}
Expand All @@ -24,6 +25,7 @@ pub fn asr(self : BigInt, n : Int) -> BigInt {
/// Only the absolute value is shifted.
///
/// @alert deprecated "Use infix bitwise operator `<<` instead"
/// @coverage.skip
pub fn shl(self : BigInt, n : Int) -> BigInt {
self << n
}
Expand All @@ -34,6 +36,7 @@ pub fn shl(self : BigInt, n : Int) -> BigInt {
/// Only the absolute value is shifted.
///
/// @alert deprecated "Use infix bitwise operator `<<` instead"
/// @coverage.skip
pub fn lsl(self : BigInt, n : Int) -> BigInt {
self << n
}
Expand All @@ -44,6 +47,7 @@ pub fn lsl(self : BigInt, n : Int) -> BigInt {
/// Only the absolute value is shifted.
///
/// @alert deprecated "Use infix bitwise operator `>>` instead"
/// @coverage.skip
pub fn shr(self : BigInt, n : Int) -> BigInt {
self >> n
}
2 changes: 2 additions & 0 deletions builtin/byte.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ pub fn Byte::op_shr(self : Byte, count : Int) -> Byte {
/// Returns the resulting `Byte` value after the bitwise left shift operation.
///
/// @alert deprecated "Use infix operator `<<` instead"
/// @coverage.skip
pub fn Byte::lsl(self : Byte, count : Int) -> Byte {
(self.to_int() << count).to_byte()
}
Expand All @@ -259,6 +260,7 @@ pub fn Byte::lsl(self : Byte, count : Int) -> Byte {
/// Returns the result of the logical shift right operation as a `Byte`.
///
/// @alert deprecated "Use infix operator `>>` instead"
/// @coverage.skip
pub fn Byte::lsr(self : Byte, count : Int) -> Byte {
(self.to_uint() >> count).reinterpret_as_int().to_byte()
}
6 changes: 6 additions & 0 deletions builtin/bytes.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn unsafe_sub_string(
/// starts at `byte_offset` and has length `byte_length`.
///
/// @alert deprecated "Use `to_unchecked_string` instead"
/// @coverage.skip
pub fn sub_string(self : Bytes, byte_offset : Int, byte_length : Int) -> String {
self.to_unchecked_string(offset=byte_offset, length=byte_length)
}
Expand All @@ -45,6 +46,7 @@ pub fn sub_string(self : Bytes, byte_offset : Int, byte_length : Int) -> String
/// Create a new unchecked string from byte sequence.
///
/// @alert deprecated "Use `to_unchecked_string` instead"
/// @coverage.skip
pub fn to_string(self : Bytes) -> String {
self.to_unchecked_string(offset=0, length=self.length())
}
Expand All @@ -70,6 +72,7 @@ pub fn to_unchecked_string(
/// Copy `length` chars from string `str`, starting at `str_offset`,
/// into byte sequence `self`, starting at `bytes_offset`.
/// @alert deprecated "The type Bytes is about to be changed to be immutable. Use `FixedArray[Byte]` or `Buffer` instead."
/// @coverage.skip
pub fn blit_from_string(
self : Bytes,
bytes_offset : Int,
Expand Down Expand Up @@ -150,6 +153,7 @@ pub fn copy(self : Bytes) -> Bytes {
/// Fill UTF8 encoded char `value` into byte sequence `self`, starting at `offset`.
/// It return the length of bytes has been written.
/// @alert deprecated "The type Bytes is about to be changed to be immutable. Use `FixedArray[Byte]` or `Buffer` instead."
/// @coverage.skip
pub fn set_utf8_char(self : Bytes, offset : Int, value : Char) -> Int {
let code = value.to_uint()
match code {
Expand Down Expand Up @@ -220,6 +224,7 @@ pub fn set_utf8_char(
/// It return the length of bytes has been written.
/// @alert unsafe "Panic if the [value] is out of range"
/// @alert deprecated "The type Bytes is about to be changed to be immutable. Use `FixedArray[Byte]` or `Buffer` instead."
/// @coverage.skip
pub fn set_utf16_char(self : Bytes, offset : Int, value : Char) -> Int {
let code = value.to_uint()
if code < 0x10000 {
Expand All @@ -245,6 +250,7 @@ pub fn set_utf16_char(self : Bytes, offset : Int, value : Char) -> Int {
/// It return the length of bytes has been written.
/// @alert unsafe "Panic if the [value] is out of range"
/// @alert deprecated "Use `set_utf16le_char` instead"
/// @coverage.skip
pub fn set_utf16_char(
self : FixedArray[Byte],
offset : Int,
Expand Down
1 change: 1 addition & 0 deletions builtin/console.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub fn println[T : Show](input : T) -> Unit {

///|
/// @alert deprecated "Use `println` instead"
/// @coverage.skip
pub fn print[T : Show](input : T) -> Unit {
println(input)
}
Expand Down
13 changes: 13 additions & 0 deletions builtin/int64_js.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -453,30 +453,35 @@ pub fn Int64::lxor(self : Int64, other : Int64) -> Int64 {

///|
/// @alert deprecated "Use infix operator `<<` instead"
/// @coverage.skip
pub fn Int64::lsl(self : Int64, other : Int) -> Int64 {
MyInt64::from_int64(self).lsl(other).to_int64()
}

///|
/// @alert deprecated "Use infix operator `<<` instead"
/// @coverage.skip
pub fn Int64::shl(self : Int64, other : Int) -> Int64 {
MyInt64::from_int64(self).lsl(other).to_int64()
}

///|
/// @alert deprecated "Use UInt64 type and infix operator `>>` instead"
/// @coverage.skip
pub fn Int64::lsr(self : Int64, other : Int) -> Int64 {
MyInt64::from_int64(self).lsr(other).to_int64()
}

///|
/// @alert deprecated "Use infix operator `>>` instead"
/// @coverage.skip
pub fn Int64::shr(self : Int64, other : Int) -> Int64 {
MyInt64::from_int64(self).asr(other).to_int64()
}

///|
/// @alert deprecated "Use infix operator `>>` instead"
/// @coverage.skip
pub fn Int64::asr(self : Int64, other : Int) -> Int64 {
MyInt64::from_int64(self).asr(other).to_int64()
}
Expand Down Expand Up @@ -595,6 +600,7 @@ pub fn Double::to_int64(self : Double) -> Int64 {

///|
/// @alert deprecated "Use `reinterpret_as_int64` instead"
/// @coverage.skip
pub fn Double::reinterpret_as_i64(self : Double) -> Int64 {
MyInt64::reinterpret_double(self).to_int64()
}
Expand All @@ -606,6 +612,7 @@ pub fn Double::reinterpret_as_int64(self : Double) -> Int64 {

///|
/// @alert deprecated "Use `reinterpret_as_uint64` instead"
/// @coverage.skip
pub fn Double::reinterpret_as_u64(self : Double) -> UInt64 {
MyInt64::reinterpret_double(self).to_uint64()
}
Expand Down Expand Up @@ -633,6 +640,7 @@ fn MyInt64::from_uint64(value : UInt64) -> MyInt64 = "%identity"

///|
/// @alert deprecated "Use `reinterpret_as_uint64` instead"
/// @coverage.skip
pub fn Int64::to_uint64(self : Int64) -> UInt64 = "%identity"

///|
Expand Down Expand Up @@ -665,6 +673,7 @@ pub fn UInt64::op_mod(self : UInt64, other : UInt64) -> UInt64 {

///|
/// @alert deprecated "Use reinterpret_as_int64 instead"
/// @coverage.skip
pub fn UInt64::to_int64(self : UInt64) -> Int64 = "%identity"

///|
Expand Down Expand Up @@ -722,24 +731,28 @@ pub fn UInt64::lnot(self : UInt64) -> UInt64 {

///|
/// @alert deprecated "Use infix operator `<<` instead"
/// @coverage.skip
pub fn UInt64::lsl(self : UInt64, shift : Int) -> UInt64 {
MyInt64::lsl(MyInt64::from_uint64(self), shift).to_uint64()
}

///|
/// @alert deprecated "Use infix operator `<<` instead"
/// @coverage.skip
pub fn UInt64::lsr(self : UInt64, shift : Int) -> UInt64 {
MyInt64::lsr(MyInt64::from_uint64(self), shift).to_uint64()
}

///|
/// @alert deprecated "Use infix operator `>>` instead"
/// @coverage.skip
pub fn UInt64::shl(self : UInt64, shift : Int) -> UInt64 {
MyInt64::lsl(MyInt64::from_uint64(self), shift).to_uint64()
}

///|
/// @alert deprecated "Use infix operator `>>` instead"
/// @coverage.skip
pub fn UInt64::shr(self : UInt64, shift : Int) -> UInt64 {
MyInt64::lsr(MyInt64::from_uint64(self), shift).to_uint64()
}
Expand Down
Loading
Loading