Skip to content

Commit

Permalink
chore: update copyright year for all files to 2025 + run moon fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mindreframer committed Jan 11, 2025
1 parent ddb3913 commit 95490f1
Show file tree
Hide file tree
Showing 224 changed files with 469 additions and 469 deletions.
4 changes: 2 additions & 2 deletions array/array_test.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -125,7 +125,7 @@ test "eachi" {
let v = [3, 4, 5]
let mut sum = 0
for i, x in v {
// todo: maybe support (i,x)
// todo: maybe support (i,x)
sum = sum + x + i
}
assert_eq!(sum, 15)
Expand Down
26 changes: 13 additions & 13 deletions array/fixedarray_sort_by.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,11 +14,11 @@

///|
/// Sorts the array with a key extraction function.
///
///
/// It's an in-place, unstable sort(it will reorder equal elements). The time complexity is O(n log n) in the worst case.
///
///
/// # Example
///
///
/// ```
/// let arr = [5, 3, 2, 4, 1]
/// arr.sort_by_key(fn (x) {-x})
Expand Down Expand Up @@ -47,11 +47,11 @@ test "@array.sort_by_key/basic" {

///|
/// Sorts the array with a custom comparison function.
///
///
/// It's an in-place, unstable sort(it will reorder equal elements). The time complexity is O(n log n) in the worst case.
///
///
/// # Example
///
///
/// ```
/// let arr = [5, 3, 2, 4, 1]
/// arr.sort_by(fn (a, b) { a - b })
Expand Down Expand Up @@ -182,9 +182,9 @@ fn fixed_quick_sort_by[T](

///|
/// Try to sort the array with bubble sort.
///
///
/// It will only tolerate at most 8 unsorted elements. The time complexity is O(n).
///
///
/// Returns whether the array is sorted.
fn fixed_try_bubble_sort_by[T](
arr : FixedArraySlice[T],
Expand All @@ -210,9 +210,9 @@ fn fixed_try_bubble_sort_by[T](

///|
/// Try to sort the array with bubble sort.
///
///
/// It will only tolerate at most 8 unsorted elements. The time complexity is O(n).
///
///
/// Returns whether the array is sorted.
fn fixed_bubble_sort_by[T](
arr : FixedArraySlice[T],
Expand Down Expand Up @@ -262,9 +262,9 @@ fn fixed_partition_by[T](

///|
/// Choose a pivot index for quick sort.
///
///
/// It avoids worst case performance by choosing a pivot that is likely to be close to the median.
///
///
/// Returns the pivot index and whether the array is likely sorted.
fn fixed_choose_pivot_by[T](
arr : FixedArraySlice[T],
Expand Down
2 changes: 1 addition & 1 deletion array/fixedarray_test.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion array/panic_test.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion array/slice.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
16 changes: 8 additions & 8 deletions array/sort.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,11 +14,11 @@

///|
/// Sorts the array in place.
///
///
/// It's an in-place, unstable sort(it will reorder equal elements). The time complexity is O(n log n) in the worst case.
///
///
/// # Example
///
///
/// ```
/// let arr = [5, 4, 3, 2, 1]
/// arr.sort()
Expand Down Expand Up @@ -105,9 +105,9 @@ fn get_limit(len : Int) -> Int {

///|
/// Try to sort the array with bubble sort.
///
///
/// It will only tolerate at most 8 unsorted elements. The time complexity is O(n).
///
///
/// Returns whether the array is sorted.
fn try_bubble_sort[T : Compare](arr : ArrayView[T]) -> Bool {
let max_tries = 8
Expand Down Expand Up @@ -159,9 +159,9 @@ fn partition[T : Compare](arr : ArrayView[T], pivot_index : Int) -> (Int, Bool)

///|
/// Choose a pivot index for quick sort.
///
///
/// It avoids worst case performance by choosing a pivot that is likely to be close to the median.
///
///
/// Returns the pivot index and whether the array is likely sorted.
fn choose_pivot[T : Compare](arr : ArrayView[T]) -> (Int, Bool) {
let len = arr.length()
Expand Down
26 changes: 13 additions & 13 deletions array/sort_by.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,11 +14,11 @@

///|
/// Sorts the array with a key extraction function.
///
///
/// It's an in-place, unstable sort(it will reorder equal elements). The time complexity is O(n log n) in the worst case.
///
///
/// # Example
///
///
/// ```
/// let arr = [5, 3, 2, 4, 1]
/// arr.sort_by_key(fn (x) {-x})
Expand All @@ -35,11 +35,11 @@ pub fn sort_by_key[T, K : Compare](self : Array[T], map : (T) -> K) -> Unit {

///|
/// Sorts the array with a custom comparison function.
///
///
/// It's an in-place, unstable sort(it will reorder equal elements). The time complexity is O(n log n) in the worst case.
///
///
/// # Example
///
///
/// ```
/// let arr = [5, 3, 2, 4, 1]
/// arr.sort_by(fn (a, b) { a - b })
Expand Down Expand Up @@ -119,9 +119,9 @@ fn quick_sort_by[T](

///|
/// Try to sort the array with bubble sort.
///
///
/// It will only tolerate at most 8 unsorted elements. The time complexity is O(n).
///
///
/// Returns whether the array is sorted.
fn try_bubble_sort_by[T](arr : ArrayView[T], cmp : (T, T) -> Int) -> Bool {
let max_tries = 8
Expand All @@ -144,9 +144,9 @@ fn try_bubble_sort_by[T](arr : ArrayView[T], cmp : (T, T) -> Int) -> Bool {

///|
/// Try to sort the array with bubble sort.
///
///
/// It will only tolerate at most 8 unsorted elements. The time complexity is O(n).
///
///
/// Returns whether the array is sorted.
fn bubble_sort_by[T](arr : ArrayView[T], cmp : (T, T) -> Int) -> Unit {
for i = 1; i < arr.length(); i = i + 1 {
Expand Down Expand Up @@ -181,9 +181,9 @@ fn partition_by[T](

///|
/// Choose a pivot index for quick sort.
///
///
/// It avoids worst case performance by choosing a pivot that is likely to be close to the median.
///
///
/// Returns the pivot index and whether the array is likely sorted.
fn choose_pivot_by[T](arr : ArrayView[T], cmp : (T, T) -> Int) -> (Int, Bool) {
let len = arr.length()
Expand Down
2 changes: 1 addition & 1 deletion array/utils.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion array/view_test.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion bool/bool_test.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion buffer/buffer_test.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion builtin/array_nonjs_test.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions builtin/array_test.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -129,7 +129,7 @@ test "array_append" {
arr1.append(arr3)
assert_eq!(arr1.length(), 6 + cap)
// assert_eq!(arr1.capacity(), arr1.length())
// Not testing capacity as it may be platform/algorithm
// Not testing capacity as it may be platform/algorithm
// dependent and not guaranteed to be equal to length
}

Expand Down
2 changes: 1 addition & 1 deletion builtin/array_wbtest.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
14 changes: 7 additions & 7 deletions builtin/arraycore_js.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
// limitations under the License.

//#region
// These types are of workaround for the restriction that MoonBit do not support
// These types are of workaround for the restriction that MoonBit do not support
// generic type parameters of extern ffi

///|
Expand Down Expand Up @@ -131,7 +131,7 @@ test "UninitializedArray::unsafe_blit_fixed" {
///|
/// Reserves capacity to ensure that it can hold at least the number of elements
/// specified by the `capacity` argument.
///
///
/// **NOTE**: This method does nothing on js platform.
/// # Example
///
Expand Down Expand Up @@ -206,10 +206,10 @@ pub fn pop_exn[T](self : Array[T]) -> T {

///|
/// Removes the last element from a array and returns it.
///
///
/// **NOTE** This method will not cause a panic, but it may result in undefined
/// behavior on the JavaScript platform. Use with caution.
///
/// behavior on the JavaScript platform. Use with caution.
///
/// @alert unsafe "Panic if the array is empty."
pub fn unsafe_pop[T](self : Array[T]) -> T {
JSArray::ofAnyArray(self).pop().toAny()
Expand Down Expand Up @@ -280,7 +280,7 @@ pub fn insert[T](self : Array[T], index : Int, value : T) -> Unit {
///|
/// Resize the array in-place so that `len` is equal to `new_len`.
///
/// If `new_len` is greater than `len`, the array will be extended by the
/// If `new_len` is greater than `len`, the array will be extended by the
/// difference, and the values in the new slots are left uninitilized.
/// If `new_len` is less than `len`, it will panic
///
Expand Down
2 changes: 1 addition & 1 deletion builtin/assert.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion builtin/autoloc.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions builtin/bigint_deprecated.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@ pub fn asr(self : BigInt, n : Int) -> BigInt {
/// Left shift a bigint
/// The sign of the result is the same as the sign of the input.
/// Only the absolute value is shifted.
///
///
/// @alert deprecated "Use infix bitwise operator `<<` instead"
/// @coverage.skip
pub fn shl(self : BigInt, n : Int) -> BigInt {
Expand All @@ -34,7 +34,7 @@ pub fn shl(self : BigInt, n : Int) -> BigInt {
/// Left shift a bigint
/// The sign of the result is the same as the sign of the input.
/// Only the absolute value is shifted.
///
///
/// @alert deprecated "Use infix bitwise operator `<<` instead"
/// @coverage.skip
pub fn lsl(self : BigInt, n : Int) -> BigInt {
Expand All @@ -45,7 +45,7 @@ pub fn lsl(self : BigInt, n : Int) -> BigInt {
/// Right shift a bigint
/// The sign of the result is the same as the sign of the input.
/// Only the absolute value is shifted.
///
///
/// @alert deprecated "Use infix bitwise operator `>>` instead"
/// @coverage.skip
pub fn shr(self : BigInt, n : Int) -> BigInt {
Expand Down
2 changes: 1 addition & 1 deletion builtin/bigint_js_wbtest.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions builtin/bigint_nonjs_wbtest.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,7 @@ test "debug_string" {
(buf as &Logger).write_iter(v.iter(), sep="\n", prefix="", suffix="")
// Logger::writer_iter()
// trait logger has no method write_iter
// precise:
// precise:
// (dyn Logger)::write_iter(buf,..)
// Logger::trait_method()
inspect!(
Expand Down
2 changes: 1 addition & 1 deletion builtin/bigint_wbtest.mbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 International Digital Economy Academy
// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 95490f1

Please sign in to comment.