Comments (2)
Would that mean you could upcast the record itself?
void fn((int,) record) {}
void maybeFn((Object?,) record) {
if (record.$1 is int) {
fn(record); // (Object?,) is now assignable to (int,)
}
}
If so, that'd be quite cool.
Currently to do that we'd have to use type matching against the entire object:
void maybeFn((Object?,) record) {
if (record is (int,)) {
fn(record);
}
}
But that can be tedious as records get more properties.
from language.
I think this is a duplicate of #2503.
from language.
Related Issues (20)
- Promote `obj` to non-null when checking `obj?.field == value` HOT 3
- Trailing Parameter HOT 6
- Dart Implicit Static Access HOT 5
- How do we handle deferred imports in enhanced parts? HOT 1
- Simple parts with imports HOT 6
- Expressions that are "as constant as possible" HOT 20
- Switching on bounded generic types HOT 5
- Add AI issue summary HOT 9
- Type parameters with default value for classes HOT 7
- Reintroduce varargs parameter in functions (in limited capacity) HOT 7
- implement an 'implies' logical operator HOT 9
- Some "reach the end" errors are not reported. Fix it, or twist the spec? HOT 11
- Allow `case` condition in return statement HOT 3
- Why can't I write a guard clause for each pattern in the guard clause of pattern matching? HOT 6
- Add `default` Keyword and New `::default` Operator for Using Default Parameters HOT 1
- Generic type as function return type can't work HOT 2
- Trying to get `this` type is incredibly unweildy. Ref: `Self` from Rust HOT 1
- Tree-shaking not producing the same result depending on whether Dart code is compiled as Javascript or Android binary HOT 2
- Making `redeclare` a language feature? HOT 1
- Custom generators (like `async`, `async*` and `sync*`) HOT 2
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 language.