generated from grodin/kotlin-android-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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(deps): update kotlinresult to v2 (major) #315
Open
renovate
wants to merge
1
commit into
develop
Choose a base branch
from
renovate/major-kotlinresult
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
2 times, most recently
from
March 19, 2024 00:07
d7f02e8
to
9a016e6
Compare
Not at all sure I want to merge this. There's a significant decrease in type safety in v2 for a decrease in allocations which I'm not convinced is the right tradeoff. |
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
6 times, most recently
from
March 26, 2024 08:15
9cae90b
to
06202e2
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
5 times, most recently
from
April 5, 2024 11:37
65434ad
to
e7f0972
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
4 times, most recently
from
April 17, 2024 17:57
109815c
to
45f26fe
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
2 times, most recently
from
April 18, 2024 08:14
defc30c
to
581560d
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
7 times, most recently
from
May 7, 2024 13:59
0273b85
to
2049e8c
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
3 times, most recently
from
May 17, 2024 18:35
110af4e
to
719b640
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
3 times, most recently
from
July 2, 2024 09:41
0b27a42
to
6f75e0c
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
3 times, most recently
from
July 17, 2024 07:13
c7df2cb
to
2d60807
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
5 times, most recently
from
July 28, 2024 09:13
4508ed9
to
0d94fc3
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
2 times, most recently
from
August 15, 2024 11:35
be9ec7a
to
cf5e821
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
2 times, most recently
from
August 20, 2024 07:19
7aa6184
to
4c17fda
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
4 times, most recently
from
September 3, 2024 16:19
53dcf10
to
ebf2934
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
4 times, most recently
from
September 12, 2024 08:38
cf37591
to
7844e13
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
3 times, most recently
from
September 17, 2024 07:21
a232c8b
to
5a3bfcf
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
from
October 4, 2024 14:53
5a3bfcf
to
bcd2115
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
from
October 13, 2024 09:12
bcd2115
to
f6a771e
Compare
renovate
bot
force-pushed
the
renovate/major-kotlinresult
branch
from
October 13, 2024 09:14
f6a771e
to
4e42e1c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.1.21
->2.0.0
1.1.21
->2.0.0
Release Notes
michaelbull/kotlin-result (com.michael-bull.kotlin-result:kotlin-result-coroutines)
v2.0.0
Compare Source
981fbe2
)eecd1b7
)Migration Guide
Ok
/Err
as TypesThe migration to an inline value class means that using
Ok
/Err
as types is no longer valid.Consumers that need to introspect the type of
Result
should instead useResult.isOk
/Result.isErr
booleans. This naming scheme matches Rust'sis_ok
&is_err
functions.Before:
After:
Type Casting
When changing the return type to another result, e.g. the
map
function which goes fromResult<V, E>
toResult<U, E>
, consumers are encouraged to use theasOk
/asErr
extension functions in conjunction with theisOk
/isErr
guard.The example below calls
asErr
which unsafely casts theResult<V, E
toResult<Nothing, E>
, which is acceptable given theisOk
check, which satisfies theResult<U, E>
return type.The
asOk
/asOk
functions should not be used outside of a manual type guard viaisOk
/isErr
- the cast is unsafe.Removal of Deprecations
The following previously deprecated behaviours have been removed in v2.
binding
&SuspendableResultBinding
, usecoroutineBinding
insteadand
without lambda argument, useandThen
insteadResultBinding
, useBindingScope
insteadgetOr
without lambda argument, usegetOrElse
insteadgetErrorOr
without lambda argument, usegetErrorOrElse
insteadgetAll
, usefilterValues
insteadgetAllErrors
, usefilterErrors
insteador
without lambda argument, useorElse
insteadResult.of
, userunCatching
insteadexpect
with non-lazy evaluation ofmessage
expectError
with non-lazy evaluation ofmessage
Inline Value Class - Before & After
The base
Result
class is now modelled as an inline value class. References toOk<V>
/Err<E>
as types should be replaced withResult<V, Nothing>
andResult<Nothing, E>
respectively.Calls to
Ok
andErr
still function, but they no longer create a new instance of theOk
/Err
objects - instead these are top-level functions that return a type ofResult
. This change achieves code that produces zero object allocations when on the "happy path", i.e. anything that returns anOk(value)
. Previously, every successful operation wrapped its returned value in anew Ok(value)
object.The
Err(error)
function still allocates a new object each call by internally wrapping the providederror
with a new instance of aFailure
object. ThisFailure
class is an internal implementation detail and not exposed to consumers. As a call toErr
is usually a terminal state, occurring at the end of a chain, the allocation of a new object is unlikely to cause a lot of GC pressure unless a function that produces anErr
is called in a tight loop.Below is a comparison of the bytecode decompiled to Java produced before and after this change. The total number of possible object allocations is reduced from 4 to 1, with 0 occurring on the happy path and 1 occurring on the unhappy path.
Before: 4 object allocations, 3 on happy path & 1 on unhappy path
After: 1 object allocation, 0 on happy path & 1 on unhappy path
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.