Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Update to pedantic 1.8.0, also no implicit casts (#50)
Browse files Browse the repository at this point in the history
* Update to pedantic 1.8.0, also no implicit casts

* format file

* Update min SDK

* Add a changelog entry
  • Loading branch information
keertip authored Oct 10, 2019
1 parent a8b3d5d commit eb37486
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: dart

dart:
- 2.0.0
- 2.1.1
- dev

dart_task:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.11-dev

* Update minimum SDK constraint to version 2.1.1.

## 0.10.10

* Fix `Int64` parsing to throw `FormatException` on an empty string or single
Expand Down
3 changes: 3 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
include: package:pedantic/analysis_options.yaml
analyzer:
strong-mode:
implicit-casts: false
linter:
rules:
#- annotate_overrides
Expand Down
4 changes: 2 additions & 2 deletions lib/src/int32.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Int32 implements IntX {
if (digit < 0 || digit >= radix) {
throw FormatException("Non-radix code unit: $c");
}
x = (x * radix) + digit;
x = ((x * radix) + digit) as Int32;
}
return x;
}
Expand Down Expand Up @@ -189,7 +189,7 @@ class Int32 implements IntX {
Int64 t = this.toInt64();
return (t - (t ~/ other) * other).toInt32();
}
return this - (this ~/ other) * other;
return (this - (this ~/ other) * other) as Int32;
}

Int32 operator &(other) {
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: fixnum
version: 0.10.10
version: 0.10.11-dev

description: Library for 32- and 64-bit signed fixed-width integers.
author: Dart Team <[email protected]>
homepage: https://github.com/dart-lang/fixnum

environment:
sdk: '>=2.0.0 <3.0.0'
sdk: '>=2.1.1 <3.0.0'

dev_dependencies:
pedantic: ^1.3.0
pedantic: ^1.8.0
test: ^1.2.0
10 changes: 5 additions & 5 deletions test/int32_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ void main() {

test("remainder", () {
expect(Int32(0x12345678).remainder(Int32(0x22)),
Int32(0x12345678.remainder(0x22)));
Int32(0x12345678.remainder(0x22) as int));
expect(Int32(0x12345678).remainder(Int32(-0x22)),
Int32(0x12345678.remainder(-0x22)));
Int32(0x12345678.remainder(-0x22) as int));
expect(Int32(-0x12345678).remainder(Int32(-0x22)),
Int32(-0x12345678.remainder(-0x22)));
Int32(-0x12345678.remainder(-0x22) as int));
expect(Int32(-0x12345678).remainder(Int32(0x22)),
Int32(-0x12345678.remainder(0x22)));
Int32(-0x12345678.remainder(0x22) as int));
expect(Int32(0x12345678).remainder(Int64(0x22)),
Int32(0x12345678.remainder(0x22)));
Int32(0x12345678.remainder(0x22) as int));
expect(() => Int32(17).remainder(null), throwsArgumentError);
});

Expand Down
10 changes: 5 additions & 5 deletions test/int64_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,15 @@ void main() {
expect(Int64.MAX_VALUE % Int64.fromInts(0x04000000, 0x00000000),
Int64.fromInts(0x3ffffff, 0xffffffff));
expect(Int64(0x12345678).remainder(Int64(0x22)),
Int64(0x12345678.remainder(0x22)));
Int64(0x12345678.remainder(0x22) as int));
expect(Int64(0x12345678).remainder(Int64(-0x22)),
Int64(0x12345678.remainder(-0x22)));
Int64(0x12345678.remainder(-0x22) as int));
expect(Int64(-0x12345678).remainder(Int64(-0x22)),
Int64(-0x12345678.remainder(-0x22)));
Int64(-0x12345678.remainder(-0x22) as int));
expect(Int64(-0x12345678).remainder(Int64(0x22)),
Int64(-0x12345678.remainder(0x22)));
Int64(-0x12345678.remainder(0x22) as int));
expect(Int32(0x12345678).remainder(Int64(0x22)),
Int64(0x12345678.remainder(0x22)));
Int64(0x12345678.remainder(0x22) as int));
argumentErrorTest("%", (a, b) => a % b);
});

Expand Down

0 comments on commit eb37486

Please sign in to comment.