-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Comments
Added Area-Compiler, Triaged labels. |
This comment was originally written by [email protected] Set owner to [email protected]. |
This comment was originally written by [email protected] http://codereview.chromium.org/8624001/ Added Started label. |
This comment was originally written by [email protected] 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= [email protected], [email protected] Review URL: https://codereview.chromium.org/2185833004 .
This was referenced Oct 29, 2020
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue was originally filed by [email protected]
What steps will reproduce the problem?
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']);
The text was updated successfully, but these errors were encountered: