Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for cast operation #3513

Closed
stevemessick opened this issue Jun 11, 2012 · 1 comment
Closed

Request for cast operation #3513

stevemessick opened this issue Jun 11, 2012 · 1 comment
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language).
Milestone

Comments

@stevemessick
Copy link
Contributor

if a function such es .queryAll("...") returns a NodeList. However if I know that this list is actually an ElementList and I pass the .queryAll("...") result to a function that expects an ElementList in it's signature I am getting i warning.

'NoteList' is not assignable to 'ElementList'.

It would be great if a "cast" like expression could be used to suppress such warnings
////////////////////////////////////////////////////////////////////////////////////
Editor Version: 8370

[Editor note: the cast operator "as" was recently introduced to the language]

@gbracha
Copy link
Contributor

gbracha commented Jun 11, 2012

What are you asking for? NodeList and ElementList are not in any subtype relation. The cast won't change that, it just makes it easy to check what type it is. You could already overcome this by assignment or by using dynamic().

@stevemessick stevemessick added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). labels Jun 11, 2012
@stevemessick stevemessick added this to the M1 milestone Jun 11, 2012
copybara-service bot pushed a commit that referenced this issue Oct 10, 2023
…t_channel, webdriver

Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/524b2b6..5156398):
  5156398c  2023-10-09  Sam Rawlins  Fix sidebar links for pub packages (#3510)
  960bac41  2023-10-09  dependabot[bot]  Bump ossf/scorecard-action from 2.2.0 to 2.3.0 (#3513)
  affc5b44  2023-10-08  Sam Rawlins  Remove some old, unused options (#3511)
  c147aa19  2023-10-06  Sam Rawlins  Fix left sidebar (#3507)

mockito (https://github.com/dart-lang/mockito/compare/49859e4..47a5588):
  47a5588  2023-10-06  Ilya Yanok  Don't try to compare fakes to real objects
  6b9eab9  2023-10-06  Ilya Yanok  Undo the formatting fix
  5ad2ff4  2023-10-05  Ilya Yanok  Change default dummy value for `String` to contain some info
  78c650b  2023-10-05  Ilya Yanok  Use SDK 3.0.0 for stable tests
  adbe265  2023-10-04  Ilya Yanok  Use 3.1.3 as stable SDK

native (https://github.com/dart-lang/native/compare/fd21f5b..22f4481):
  22f4481  2023-10-10  Daco Harkes  [native_assets_builder] Fix pub warning in tests (#155)

protobuf (https://github.com/dart-lang/protobuf/compare/c16bc89..c559fe5):
  c559fe5  2023-10-10  Ömer Sinan Ağacan  Release protoc_plugin-21.1.2 (#881)
  32ed0fe  2023-10-09  Ömer Sinan Ağacan  Fix a bug in comment parsing (#879)

test (https://github.com/dart-lang/test/compare/367aa39..4341470):
  4341470a  2023-10-06  Nate Bosch  Mention integration_test as an ignored directory (#2115)

tools (https://github.com/dart-lang/tools/compare/f318c80..92c5c15):
  92c5c15  2023-10-10  Devon Carew  update to the latest package:dart_flutter_team_lints (#174)

web_socket_channel (https://github.com/dart-lang/web_socket_channel/compare/364013d..f3ac1bf):
  f3ac1bf  2023-10-06  Nate Bosch  Mention `ready` in the docs for `connect` (#287)

webdriver (https://github.com/google/webdriver.dart/compare/21976d6..eaf9c58):
  eaf9c58  2023-10-05  Nate Bosch  Spawn test server in a background isolate (#285)
  ccd01e5  2023-10-05  dependabot[bot]  Bump actions/checkout from 3.6.0 to 4.1.0 (#284)
  f753b3e  2023-10-05  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#283)
  6bd246f  2023-10-05  Devon Carew  require dart 3.0; add publishing automation (#282)

Change-Id: I83ec9986cc8acc60be76267c2d1127f237e2b5c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329943
Auto-Submit: Devon Carew <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language).
Projects
None yet
Development

No branches or pull requests

2 participants