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

Disallow implicit casts in analysis_options #28

Merged
merged 1 commit into from
Mar 20, 2020
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
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
include: package:pedantic/analysis_options.1.9.0.yaml

analyzer:
strong-mode:
implicit-casts: false
errors:
annotate_overrides: ignore
prefer_single_quotes: ignore
Expand Down
26 changes: 12 additions & 14 deletions test/typed_buffers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,17 @@ const floatSamples = [
16777215.0
];

int clampUint8(x) => x < 0 ? 0 : x > 255 ? 255 : x;
int clampUint8(int x) => x < 0 ? 0 : x > 255 ? 255 : x;

void doubleEqual(x, y) {
void doubleEqual(x, num y) {
kevmoo marked this conversation as resolved.
Show resolved Hide resolved
if (y.isNaN) {
expect(x.isNaN, isTrue);
} else {
expect(x, equals(y));
}
}

Rounder intRounder(bits) {
Rounder intRounder(int bits) {
var highBit = 1 << (bits - 1);
var mask = highBit - 1;
return (int x) => (x & mask) - (x & highBit);
Expand All @@ -243,14 +243,14 @@ double roundToFloat(double value) {
return (Float32List(1)..[0] = value)[0];
}

void testFloat32x4Buffer(List floatSamples) {
void testFloat32x4Buffer(List<double> floatSamples) {
var float4Samples = <Float32x4>[];
for (var i = 0; i < floatSamples.length - 3; i++) {
float4Samples.add(Float32x4(floatSamples[i], floatSamples[i + 1],
floatSamples[i + 2], floatSamples[i + 3]));
}

void floatEquals(x, y) {
void floatEquals(x, num y) {
if (y.isNaN) {
expect(x.isNaN, isTrue);
} else {
Expand Down Expand Up @@ -535,7 +535,7 @@ void testUint(
}, testOn: testOn);
}

Rounder uintRounder(bits) {
Rounder uintRounder(int bits) {
var halfbits = (1 << (bits ~/ 2)) - 1;
var mask = halfbits | (halfbits << (bits ~/ 2));
return (int x) => x & mask;
Expand All @@ -551,12 +551,10 @@ class MatchesInt32x4 extends Matcher {
Description describe(Description description) =>
description.add('Int32x4.==');

bool matches(item, Map matchState) {
if (item is! Int32x4) return false;
Int32x4 value = item;
return result.x == value.x &&
result.y == value.y &&
result.z == value.z &&
result.w == value.w;
}
bool matches(item, Map matchState) =>
item is Int32x4 &&
result.x == item.x &&
result.y == item.y &&
result.z == item.z &&
result.w == item.w;
}