Skip to content

Commit 62cca11

Browse files
lynzrandpeter-jerry-ye
authored andcommitted
fix: Remove deprecated lang constructs
1 parent a309162 commit 62cca11

File tree

5 files changed

+21
-25
lines changed

5 files changed

+21
-25
lines changed

encoding/decoding_test.mbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ test "lossy decoding UTF16BE which is `HI+!LO`" {
758758
}
759759

760760
///|
761-
test "decode_lossy_to/UTF16BE" {
761+
test "decode_lossy_to/UTF16BE_2" {
762762
let src = b"\xD8\x00\x00\x48"
763763
assert_eq(src, b"\xd8\x00\x00\x48")
764764
let decoder = @encoding.decoder(UTF16BE)

rational/pkg.generated.mbti

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ impl ToJson for RationalError
2626

2727
// Types and methods
2828
type Rational[T]
29+
#as_free_fn
2930
fn[T : Integral] Rational::abs(Self[T]) -> Self[T]
30-
fnalias Rational::abs
3131
fn[T : Integral] Rational::add(Self[T], Self[T]) -> Self[T] // from trait `Add`
3232
fn[T : Integral] Rational::arbitrary(Int, @splitmix.RandomState) -> Self[T] // from trait `@quickcheck.Arbitrary`
33+
#as_free_fn
3334
fn[T : Integral] Rational::ceil(Self[T]) -> T
34-
fnalias Rational::ceil
3535
fn[T : Integral] Rational::compare(Self[T], Self[T]) -> Int // from trait `Compare`
3636
fn[T : Integral] Rational::div(Self[T], Self[T]) -> Self[T] // from trait `Div`
3737
fn[T : Eq] Rational::equal(Self[T], Self[T]) -> Bool // from trait `Eq`
38+
#as_free_fn
3839
fn[T : Integral] Rational::floor(Self[T]) -> T
39-
fnalias Rational::floor
40+
#as_free_fn
4041
fn[T : Integral] Rational::fract(Self[T]) -> Self[T]
41-
fnalias Rational::fract
42+
#as_free_fn
4243
fn[T : Integral] Rational::is_integer(Self[T]) -> Bool
43-
fnalias Rational::is_integer
4444
fn[T : Integral] Rational::mul(Self[T], Self[T]) -> Self[T] // from trait `Mul`
4545
fn[T : Integral] Rational::neg(Self[T]) -> Self[T] // from trait `Neg`
4646
#deprecated
@@ -56,13 +56,13 @@ fn[T : Integral] Rational::op_neg(Self[T]) -> Self[T] // from trait `Neg`
5656
#deprecated
5757
fn[T : Integral] Rational::op_sub(Self[T], Self[T]) -> Self[T] // from trait `Sub`
5858
fn[T : Integral] Rational::output(Self[T], &Logger) -> Unit // from trait `Show`
59+
#as_free_fn
5960
fn[T : Integral] Rational::reciprocal(Self[T]) -> Self[T]
60-
fnalias Rational::reciprocal
6161
fn[T : Integral] Rational::sub(Self[T], Self[T]) -> Self[T] // from trait `Sub`
6262
fn Rational::to_double(Self[Int64]) -> Double
6363
fn[T : Integral] Rational::to_string(Self[T]) -> String // from trait `Show`
64+
#as_free_fn
6465
fn[T : Integral] Rational::trunc(Self[T]) -> T
65-
fnalias Rational::trunc
6666
impl[T : Integral] Add for Rational[T]
6767
impl[T : Integral] Compare for Rational[T]
6868
impl[T : Integral] Div for Rational[T]

rational/rational.mbt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ pub impl[T : Integral] Div for Rational[T] with div(self, other) {
210210
/// inspect(negative_three, content="-3")
211211
/// ```
212212
///
213+
#as_free_fn
213214
pub fn[T : Integral] Rational::reciprocal(self : Rational[T]) -> Rational[T] {
214215
if self.numerator.signum() < 0 {
215216
new_unchecked(-self.denominator, -self.numerator)
@@ -263,6 +264,7 @@ pub impl[T : Integral] Neg for Rational[T] with neg(self : Rational[T]) -> Ratio
263264
/// inspect(negative.abs(), content="3/4")
264265
/// ```
265266
///
267+
#as_free_fn
266268
pub fn[T : Integral] Rational::abs(self : Rational[T]) -> Rational[T] {
267269
new_unchecked(self.numerator.abs(), self.denominator)
268270
}
@@ -514,6 +516,7 @@ pub fn from_double(value : Double) -> Rational64 raise RationalError {
514516
/// inspect(r3.ceil(), content="2")
515517
/// ```
516518
///
519+
#as_free_fn
517520
pub fn[T : Integral] Rational::ceil(self : Rational[T]) -> T {
518521
let sign = if self.numerator.signum() < 0 {
519522
T::from_int(-1)
@@ -551,6 +554,7 @@ pub fn[T : Integral] Rational::ceil(self : Rational[T]) -> T {
551554
/// inspect(r3.floor(), content="2")
552555
/// ```
553556
///
557+
#as_free_fn
554558
pub fn[T : Integral] Rational::floor(self : Rational[T]) -> T {
555559
let sign = if self.numerator.signum() < 0 {
556560
T::from_int(-1)
@@ -590,6 +594,7 @@ pub fn[T : Integral] Rational::floor(self : Rational[T]) -> T {
590594
/// inspect(d.trunc(), content="-2")
591595
/// ```
592596
///
597+
#as_free_fn
593598
pub fn[T : Integral] Rational::trunc(self : Rational[T]) -> T {
594599
if self.numerator.signum() < 0 {
595600
-(-self.numerator / self.denominator)
@@ -622,6 +627,7 @@ pub fn[T : Integral] Rational::trunc(self : Rational[T]) -> T {
622627
/// inspect(r3.fract(), content="0") // fractional part is 0
623628
/// ```
624629
///
630+
#as_free_fn
625631
pub fn[T : Integral] Rational::fract(self : Rational[T]) -> Rational[T] {
626632
new_unchecked(self.numerator % self.denominator, self.denominator)
627633
}
@@ -709,12 +715,12 @@ pub impl[T : Integral] @quickcheck.Arbitrary for Rational[T] with arbitrary(
709715
/// inspect(zero.is_integer(), content="true")
710716
/// ```
711717
///
718+
#as_free_fn
712719
pub fn[T : Integral] Rational::is_integer(self : Rational[T]) -> Bool {
713720
self.denominator == T::from_int(1)
714721
}
715722
716723
///|
717-
pub fnalias Rational::(abs, ceil, floor, trunc, is_integer, fract, reciprocal)
718724
719725
///|
720726
test "op_add" {

stack/pkg.generated.mbti

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ fn[T] Stack::from_stack(Self[T]) -> Self[T]
2626
fn[T] Stack::is_empty(Self[T]) -> Bool
2727
fn[T] Stack::iter(Self[T]) -> Iter[T]
2828
fn[T] Stack::length(Self[T]) -> Int
29+
#as_free_fn
2930
fn[T] Stack::new() -> Self[T]
30-
fnalias Stack::new
31+
#as_free_fn
3132
fn[T] Stack::of(FixedArray[T]) -> Self[T]
32-
fnalias Stack::of
3333
fn[T : Eq] Stack::op_equal(Self[T], Self[T]) -> Bool
3434
fn[T : Show] Stack::output(Self[T], &Logger) -> Unit // from trait `Show`
3535
fn[T] Stack::peek(Self[T]) -> T?

stack/stack.mbt

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
///|
16-
/// Create an empty stack.
17-
///
18-
/// # Example
19-
///
20-
/// ```
21-
/// let s : Stack[Int] = @stack.new()
22-
/// assert_true(s.is_empty())
23-
/// ```
24-
pub fnalias Stack::new
25-
2615
///|
2716
/// Create an empty stack.
2817
///
@@ -31,7 +20,10 @@ pub fnalias Stack::new
3120
/// ```
3221
/// let s : Stack[Int] = @stack.Stack::new()
3322
/// assert_true(s.is_empty())
23+
/// let s1 : Stack[Int] = @stack.new()
24+
/// assert_true(s.is_empty())
3425
/// ```
26+
#as_free_fn
3527
pub fn[T] Stack::new() -> Stack[T] {
3628
{ elements: @list.from_array([]), len: 0 }
3729
}
@@ -85,13 +77,11 @@ test "from_iter" {
8577
/// let s = of([1, 2, 3])
8678
/// assert_eq(s.length(), 3)
8779
/// ```
80+
#as_free_fn
8881
pub fn[T] Stack::of(array : FixedArray[T]) -> Stack[T] {
8982
{ elements: @list.of(array), len: array.length() }
9083
}
9184
92-
///|
93-
pub fnalias Stack::of
94-
9585
///|
9686
test "of" {
9787
let s = of([1, 2, 3])

0 commit comments

Comments
 (0)