Comments (2)
Here's the fun bit. With this diff, no compiler crash:
diff --git a/lib/src/sokoban_view/components/grided.dart b/lib/src/sokoban_view/components/grided.dart
index 198775a..e28a176 100644
--- a/lib/src/sokoban_view/components/grided.dart
+++ b/lib/src/sokoban_view/components/grided.dart
@@ -25,6 +25,6 @@ mixin GridElement {
Vector2 getPosition() => Vector2(
(gridPosition.x * gridPixelDimensions.x) + gridPixelOffset.x,
(gridPosition.y * gridPixelDimensions.y) + gridPixelOffset.y);
- double getGridValue() => (gridPosition.y * 13.0) + gridPosition.x;
- int getLayeredGridValue() => getGridValue().toInt() + (layer * 200);
+ int getGridValue() => ((gridPosition.y * 13.0) + gridPosition.x).toInt();
+ int getLayeredGridValue() => getGridValue() + (layer * 200);
}
diff --git a/lib/src/sokoban_view/components/world.dart b/lib/src/sokoban_view/components/world.dart
index c68e5a8..c2460f3 100644
--- a/lib/src/sokoban_view/components/world.dart
+++ b/lib/src/sokoban_view/components/world.dart
@@ -158,7 +158,7 @@ class SokobanWorld extends World with HasGameRef {
var initialIdx = int.parse(split[1]);
var nextIdx = int.parse(split[2]);
var goalHit = bool.parse(split[3]);
- var gridValue = box.getGridValue() as int;
+ var gridValue = box.getGridValue();
logger.i('box $idx $gridValue');
if (gridValue == initialIdx) {
@@ -183,7 +183,7 @@ class SokobanWorld extends World with HasGameRef {
for (var idx = 0; idx < batteries.length; idx++) {
var battery = batteries[idx];
- var gridValue = battery.getGridValue() as int;
+ var gridValue = battery.getGridValue();
if (gridValue == initialIdx) {
battery.hide();
from sdk.
Smaller repro:
class Num {
final double x;
Num(this.x);
double getX() => x;
}
void main() {
final num = Num(0.0);
var value = num.getX() as int;
print(value);
}
Compile with --omit-implicit-checks --omit-explicit-checks
.
from sdk.
Related Issues (20)
- `@doNotSubmit` isn't valid on member-fields HOT 5
- Regex with unicode and curly braces does not match correctly HOT 2
- Send Pointer through SendPort without an error, which is different from the doc. HOT 3
- proposal: `unnecessary_pattern_assignment` HOT 8
- [CP] [dart2wasm] Generate source maps HOT 4
- Analyzer Feedback from IntelliJ HOT 1
- Have "go to definition" jump to a class when used on a `ConstructorExpression` where the default constructor is missing HOT 2
- [analyzer] Switch cases for destructured records do not promote types HOT 1
- [Wildcard Variables] Verify that constant evaluation works as expected
- [Wildcard Variables] Resolution of wildcard import directives
- Analyzer Feedback from IntelliJ HOT 1
- Analyzer is very slow for large files HOT 1
- Enum hashCode is different when hot reloading HOT 1
- Dart lacks a way to create an error chain HOT 2
- [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: SocketException: Send failed (OS Error: No route to host, errno = 65), address = 0.0.0.0, port = 1900 HOT 1
- Inconsistent string interpolation in dart runtime with RTL languages HOT 1
- bug: Dart does not narrow the type properly across more than one level of inheritance in a collection type HOT 4
- `dart test --coverage`: getSourceReport: (-32000) Service connection disposed HOT 1
- Import name conflicts: Suggest adding "hide" on one of the conflicting imports HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.