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

Support null-safety #38

Merged
merged 18 commits into from
Jun 12, 2022
Merged

Support null-safety #38

merged 18 commits into from
Jun 12, 2022

Conversation

leynier
Copy link
Contributor

@leynier leynier commented Mar 5, 2021

Support null-safety

fix: #37
resolve: #39

@leynier
Copy link
Contributor Author

leynier commented Mar 23, 2021

@matanlurey Please, can you help me to understand why test are failed? Thanks in advance.

@Akash9151
Copy link

Hey, Is there any chance of adding null-safety support to this package soon..?

@Akash9151
Copy link

@leynier , I want to do calculations with converting int to binary, Can you suggest me any package..?

@leynier
Copy link
Contributor Author

leynier commented Jun 18, 2021

@leynier , I want to do calculations with converting int to binary, Can you suggest me any package..?

Hi @Akash9151 sorry for the delay in response, in the meanwhile, you can use the fork made by me.

binary:
    git: https://github.com/educup/binary.dart.git

@matanlurey
Copy link
Owner

Sorry for the delay, I'm willing to accept this PR or I can fork it and finish it for you @leynier.

Feel free to delete the tests that no longer make sense.

@matanlurey matanlurey reopened this Jun 12, 2022
@leynier
Copy link
Contributor Author

leynier commented Jun 12, 2022

Sorry for the delay, I'm willing to accept this PR or I can fork it and finish it for you @leynier.

Feel free to delete the tests that no longer make sense.

I made a few changes like upgrade dependencies, GH Actions, move to another linter package, and other things. The tests run correctly in my fork.

@codecov
Copy link

codecov bot commented Jun 12, 2022

Codecov Report

Merging #38 (8f55ca4) into master (05345aa) will increase coverage by 4.34%.
The diff coverage is 64.51%.

@@            Coverage Diff             @@
##           master      #38      +/-   ##
==========================================
+ Coverage   80.91%   85.25%   +4.34%     
==========================================
  Files           7        7              
  Lines         592      590       -2     
==========================================
+ Hits          479      503      +24     
+ Misses        113       87      -26     
Impacted Files Coverage Δ
lib/src/_long.dart 0.00% <0.00%> (-5.72%) ⬇️
lib/src/list.dart 80.68% <50.00%> (ø)
lib/src/_utils.dart 100.00% <100.00%> (+33.33%) ⬆️
lib/src/bit_pattern.dart 89.69% <100.00%> (+0.54%) ⬆️
lib/src/boxed_int.dart 94.89% <100.00%> (+13.17%) ⬆️
lib/src/int.dart 90.36% <100.00%> (ø)
lib/src/string.dart 100.00% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05345aa...8f55ca4. Read the comment docs.

@matanlurey matanlurey merged commit 8f55ca4 into matanlurey:master Jun 12, 2022
Copy link
Owner

@matanlurey matanlurey left a comment

Choose a reason for hiding this comment

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

Thanks! I've manually merged with a few changes.

@alwaysThrows
// ignore: prefer_void_to_null
static Null _max52Bits() {
static void _max52Bits() {
Copy link
Owner

Choose a reason for hiding this comment

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

nit: The right way to do this is have a return type of Never

- prefer_final_locals
- prefer_void_to_null
- unnecessary_overrides
include: package:lints/recommended.yaml
Copy link
Owner

Choose a reason for hiding this comment

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

nit: Thanks. This is actually less strict than the previous settings to a degree.

I've replaced this with package:matan/strict.yaml.

@@ -9,5 +9,5 @@ extension ObjectX on Object {
/// Casts the current object to type [T].
///
/// In some production compilers, this cast is skipped.
T unsafeCast<T>() => this; // ignore: return_of_invalid_type
T unsafeCast<T>() => this as T; // ignore: return_of_invalid_type
Copy link
Owner

Choose a reason for hiding this comment

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

nit: Thanks!

To keep this functionality, I needed to add the following pragmas:

  @dart2js.tryInline
  @pragma('dart2js:as:trust')

@@ -62,7 +62,7 @@ abstract class BitPatternBuilder {
///
/// print(pattern.match(0xD /* 0b1101 */)); // [1]
/// ```
BitPattern<List<int>> build([String name]);
BitPattern<List<int>?> build([String? name]);
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks. I think we don't want a BitPattern with null. I've made some changes.

@@ -50,7 +50,7 @@ extension BinaryInt on int {
static const _maxSmiBits = 31;

/// Represents `math.pow(2, 32)`, precomputed.
static const _2p32 = 0x100000000;
static const _pow2to32 = 0x100000000;
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks! Much better!

@@ -0,0 +1,13 @@
check: get format analyze tests
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks! Good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants