Comments (10)
Curious, does
throw null
become a static error?
It already is:
throw null;
produces:
The type 'Null' of the thrown expression must be assignable to 'Object'.
from sdk.
Summary: This change updates the type inference context for throw
operands from the unknown type (_
) to Object
. This aligns the context with the compiler's requirement that throw
operands be assignable to Object
, improving consistency in type inference.
from sdk.
@vsmenon @leonsenft @Hixie for breaking change review.
from sdk.
LGTM
from sdk.
Curious, does throw null
become a static error?
from sdk.
Interesting. :-)
Is that Object
not already coming from the context?
Anyway, lgtm on the change.
from sdk.
Yeah, when we implemented null safety we added the requirement that anything being thrown must be assignable to Object
(i.e. non-nullable). It would have made sense to change the context to Object
at the same time, but we didn't think to do so. (Usually the context matches what type the expression has to be in order to avoid a compile-time error, but there are exceptions, so the implementation has to keep contexts and static error checking separate. As a result, if we don't think to update the context when we add an error condition, it doesn't happen automatically.)
from sdk.
@Hixie ping
from sdk.
Marking this breaking change as approved. @Hixie if you object, please speak up.
from sdk.
Sorry for missing this. This seems like a good change.
from sdk.
Related Issues (20)
- [CP] [ CLI ] Fix issue where 'dart build' would fail to find the 'dart' when run from PATH HOT 2
- community contribution to the cli_utils library (depended upon by the sdk) HOT 1
- [dart2wasm] make `dart.library.js_util` false on conditional imports HOT 1
- Issue with Dart Content Script in Firefox Extension: browser and chrome Undefined HOT 3
- Better subclass handling for `argument_type_not_assignable` HOT 2
- Build fails: ERROR at //BUILD.gn:5:1: Can't load input file. import("build/config/gclient_args.gni") HOT 3
- Analyzer vs Extension types goes wrong HOT 2
- Memory leak runtime/bin/security_context_win.cc (New) HOT 3
- Macro application error when passing a list in a macro parameter HOT 2
- [hook] `hook/generate.dart` 🪝 HOT 3
- Interrupted iterators getting closed when compiled to JS HOT 6
- Macro-augmented constructor loses const-ness and default values HOT 1
- [enhanced-parts] Analysis Server implementation HOT 2
- Customizable IDE click-through target for generated code HOT 13
- Failures on [DEPS] Update chrome_tag to latest beta (128.0.6613.36) HOT 8
- I am not able to run any project HOT 2
- Expose `architecture` from `Abi` class HOT 5
- [CFE] Wrong error message if redirecting factory constructor has initializing formals
- Add a universal encode method HOT 3
- code generator 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 sdk.