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

fix some unused mutability & make some type private #1049

Merged
merged 2 commits into from
Sep 29, 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
4 changes: 2 additions & 2 deletions builtin/builtin.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ impl Hash for Option

impl Hash for Result

impl Hash for $default_impl
impl Hash::hash

impl Hash for Tuple(2)

Expand Down Expand Up @@ -739,7 +739,7 @@ impl Show for Bytes

impl Show for Ref

impl Show for $default_impl
impl Show::to_string

impl Show for Array

Expand Down
2 changes: 1 addition & 1 deletion math/algebraic_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ test "minimum.ref" {

// For testing purposes
priv struct T {
mut x : Int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mut is indented to make compiler unable to do unbox optimization on type T.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While there's no something likes //@warning "-unused-mut". I think we need a manual assignment statement to eliminate the warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently T will not be unboxed globally even if its only field is immutable. If some value of T is used locally by accessing field only then that particular value may be unboxed, but that's not the case here, and mutable structs also get unboxed in that case.

This test itself may be controversial but let's discuss and fix that in a separate PR

x : Int
} derive(Show, Eq, Compare)
2 changes: 1 addition & 1 deletion quickcheck/splitmix/random.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

struct RandomState {
mut seed : UInt64
mut gamma : UInt64
gamma : UInt64
} derive(Show, Default)

let golden_gamma : UInt64 = 0x9e3779b97f4a7c15
Expand Down
2 changes: 1 addition & 1 deletion strconv/number.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

let min_19digit_int : UInt64 = 100_0000_0000_0000_0000UL

struct Number {
priv struct Number {
exponent : Int64
mantissa : UInt64
negative : Bool
Expand Down
2 changes: 0 additions & 2 deletions strconv/strconv.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ impl Decimal {
to_double(Self) -> Double!StrConvError
}

type Number

pub type! StrConvError String

// Type aliases
Expand Down
4 changes: 2 additions & 2 deletions strconv/string_slice.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
/// TODO: make it a monad
priv struct StringSlice {
string : String
mut start : Int
mut end : Int
start : Int
end : Int
}

fn slice(s : String, start : Int, end : Int) -> StringSlice {
Expand Down