Closed
Description
From https://github.com/benthillerkus/analyzer_crash_repro:
class Shape {
final List<List<bool>> shape;
const Shape(this.shape)
: assert(shape.isNotEmpty),
assert(shape.first.isNotEmpty),
assert(shape.every((row) => row.length == shape.first.length));
}
Crash log
dart analyze
:
Analyzing analyzer_crash_repro... 0.5s
No issues found!
Expected output (from Dartpad):
lib/main.dart:9:16:
Error: Not a constant expression.
: assert(shape.isNotEmpty),
^^^^^
lib/main.dart:10:16:
Error: Not a constant expression.
assert(shape.first.isNotEmpty),
^^^^^
lib/main.dart:10:22:
Error: Not a constant expression.
assert(shape.first.isNotEmpty),
^^^^^
lib/main.dart:11:51:
Error: Not a constant expression.
assert(shape.every((row) => row.length == shape.first.length));
^^^^^
lib/main.dart:11:28:
Error: Not a constant expression.
assert(shape.every((row) => row.length == shape.first.length));
^^^^^
lib/main.dart:11:22:
Error: Method invocation is not a constant expression.
assert(shape.every((row) => row.length == shape.first.length));
^^^^^
Error: Compilation failed.
General info
- Dart 3.1.4 (stable) (Tue Oct 17 14:55:53 2023 +0000) on "macos_arm64"
- on macos / Version 13.5.2 (Build 22G91)
- locale is en-DE
Project info
- sdk constraint: '^3.1.4'
- dependencies:
- dev_dependencies: lints, test
Process info
Memory | CPU | Elapsed time | Command line |
---|---|---|---|
271 MB | 0.0% | 01:44 | dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.74.0 |