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

const Set.from() is compiled by dartc, but has incorrect behavior #271

Closed
DartBot opened this issue Oct 31, 2011 · 4 comments
Closed

const Set.from() is compiled by dartc, but has incorrect behavior #271

DartBot opened this issue Oct 31, 2011 · 4 comments

Comments

@DartBot
Copy link

DartBot commented Oct 31, 2011

This issue was originally filed by hjfre...@google.com


What steps will reproduce the problem?

  1. Go to dartboard
  2. Run the following:

main() {
 Set<String> trueSet = const Set.from(const ['true']);
 Set<String> falseSet = const Set.from(const ['false']);

 for (var x in trueSet)
   print(x);
 for (var x in falseSet)
   print(x);
}

What is the expected output?

Ideally:

true
false

Or, a compile error because Set apparently has no const constructor.

What do you see instead?

A clean compile, outputting:

true
true

What version of the product are you using? On what operating system?

Not on the same machine I was, but whatever trunk was on 2011/10/30. Linux x64, with a 32-bit build.

Please provide any additional information below.

floitsch says:

This is a bug in DartC. The VM correctly reports that the class Set doesn't have a const-constructor:
===
dart$ out/Release_ia32/dart_bin /tmp/bug.dart
'/tmp/bug.dart': Error: line 2 pos 54: 'const' requires const constructor: 'HashSetImplementation.from'
 Set<String> trueSet = const Set.from(const ['true']);

@floitschG
Copy link
Contributor

Added Area-Compiler, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Oct 31, 2011

This comment was originally written by mmendez@google.com


Set owner to zundel@google.com.
Added Accepted label.

@DartBot
Copy link
Author

DartBot commented Nov 22, 2011

This comment was originally written by zundel@google.com


http://codereview.chromium.org/8624001/


Added Started label.

@DartBot
Copy link
Author

DartBot commented Nov 28, 2011

This comment was originally written by zundel@google.com


r1751


Added Fixed label.

pq added a commit that referenced this issue Jul 27, 2016
Linter `0.1.22`.

* Grinder support (`rule:rule_name` and `docs:location`) for rule stub and doc generation (respectively).
* Fix to allow leading underscores in `non_constant_identifier_names`.
* New `valid_regexps` lint (#277).
* New `whitespace_around_ops` lint (#249).
* Fix to `overridden_fields` to flag overridden static fields (#274).
* New `list_remove_unrelated_type` to detect passing a non-`T` value to `List.remove()`` (#271).
* New `empty_catches` lint to catch empty catch blocks (#43).
* Fixed `close_sinks` false positive (#268).
* Added `linter` support for `--strong` to allow for running linter in strong mode.

BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2185833004 .
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants