Update to pedantic 1.8.0, also no implicit casts (#50)
* Update to pedantic 1.8.0, also no implicit casts
* format file
* Update min SDK
* Add a changelog entry
diff --git a/.travis.yml b/.travis.yml
index d1e3ba8..88939f9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: dart
dart:
- - 2.0.0
+ - 2.1.1
- dev
dart_task:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 14334c5..7ed6bc6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 6cd5230..6ddb107 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,4 +1,7 @@
include: package:pedantic/analysis_options.yaml
+analyzer:
+ strong-mode:
+ implicit-casts: false
linter:
rules:
#- annotate_overrides
diff --git a/lib/src/int32.dart b/lib/src/int32.dart
index f3cc72c..3a9d017 100644
--- a/lib/src/int32.dart
+++ b/lib/src/int32.dart
@@ -61,7 +61,7 @@
if (digit < 0 || digit >= radix) {
throw FormatException("Non-radix code unit: $c");
}
- x = (x * radix) + digit;
+ x = ((x * radix) + digit) as Int32;
}
return x;
}
@@ -189,7 +189,7 @@
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) {
diff --git a/pubspec.yaml b/pubspec.yaml
index 25e3f70..5864bc1 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -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 <misc@dartlang.org>
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
diff --git a/test/int32_test.dart b/test/int32_test.dart
index 52764b6..b9ba31a 100644
--- a/test/int32_test.dart
+++ b/test/int32_test.dart
@@ -115,15 +115,15 @@
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);
});
diff --git a/test/int64_test.dart b/test/int64_test.dart
index 9c9e7ba..1acc3a4 100644
--- a/test/int64_test.dart
+++ b/test/int64_test.dart
@@ -264,15 +264,15 @@
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);
});