Comments (1)
I think the errors might be surprising, but not completel;y unexplainable.
The const [b]
is invalid because b
is not a constant expression. In particular, it's not a constant list element.
The const A([b])
is invalid because [b]
is not a valid constant expression. It can be invalid for two reasons:
- Because
[...]
is intended to be constant, andb
is not a valid constant list element, or - Because
[b]
is not constant at all (it's a valid non-constant list expression where a constant expression is needed).
The latter is a little weird, because we'd assume that [b]
in a const context will automatically be constant, but we also require it to be valid, and it isn't.
It does seems from the error that it's the latter that triggers the error.
For [if (true) b]
and [if (false) b]
, an expression of the form [if (c) b]
is a valid constant if c
is true and b
is a valid constant expression, or if c
is false and b
is a potentially constant expression (but possibly not valid constant expression).
Here b
is neither. In the if (false)
case, that makes if (false) b
into an invalid constant expression in an element position.
In if (true)
, it the detected error is that b
(which is used here) is not constant, but it's not used directly as a list element (well, it is, but not just).
Basically, there are multiple ways each example could be deemed invalid, and the error depends on which one happens to be detected first.
(Or maybe, as you say, some errors are just more up-to-date than the others, which will follow soon enough.)
from sdk.
Related Issues (20)
- Problems with moving comments when automatically moving child arg to last parameter position of widget constructor
- Unreachable code during SelectRepresentations HOT 1
- "Stop on uncaught exceptions" sometimes stops on caught exceptions HOT 4
- Improve thrown `FormatException` from `int.parse` when there is an "invalid radix-n" number HOT 1
- Very poor JIT performance with const Map<Type, ..> HOT 7
- DateTime.fromMillisecondsSinceEpoch constructor returns invalid time HOT 2
- Option in TFA to annotate inferred method return types, local variable types HOT 4
- Failed to build Dart SDK for arm with error: "cc1: error: β-mfloat-abi=hardβ: selected architecture lacks an FPU"
- Macro doesn't execute when defined in a project outside of analysis roots HOT 2
- Potential improvements to TypedData
- How to reference extension methods in macro generated code?
- [Wildcard Variables] [meta] Wildcard variables implementation
- `dart test` with `--pause-after-load` flag does not print DevTools URI HOT 4
- DDC lowers object literal/anonymous factory constructors using the invocation's ordering HOT 3
- Abstract classes with recurring generics could warn on creation of nullable type-solving impossibility HOT 4
- What should `OmittedTypeAnnotation.code` produce? HOT 5
- Frontend type checking error with differing flow control HOT 2
- [breaking change] Add the ability to control minimum TLS version in SecurityContext HOT 3
- [Wildcard Variables] Analyzer Implementation HOT 1
- [Wildcard Variables] Analysis Server Implementation
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.