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

dart2js erroneous warning #15494

Closed
jtmcdole opened this issue Dec 6, 2013 · 2 comments
Closed

dart2js erroneous warning #15494

jtmcdole opened this issue Dec 6, 2013 · 2 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@jtmcdole
Copy link
Contributor

jtmcdole commented Dec 6, 2013

new Set.from(someList == null ? [] :
    someList);

outputs:

--- Dec 6, 2013 10:27:42 AM Running dart2js... ---
myexample.dart Warning: 'EfficientLength' is not assignable to 'Iterable<dynamic>'.
        new Set.from(someList.channelIds == null ? [] :
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/core/set.dart:54:11: Info: This is the method declaration.
  factory Set.from(Iterable<E> other) = LinkedHashSet<E>.from;
          ^^^

This is not expected.

@sgjesse
Copy link
Contributor

sgjesse commented Dec 9, 2013

Added Area-Dart2JS, Triaged labels.

@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed priority-unassigned labels Feb 29, 2016
@vsmenon vsmenon added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Jul 20, 2019
@srawlins
Copy link
Member

srawlins commented Aug 5, 2019

Whatever this was has been fixed. Try in Dart Pad:

void main() {
  var someList = ['a', 'b'];
  var l2 = new Set.from(someList == null ? [] : someList);
  print(l2);

  someList = null;
  var l3 = new Set.from(someList == null ? [] : someList);
  print(l3);
}

It prints:

{a, b}
{}

@srawlins srawlins closed this as completed Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

5 participants