-
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
Not-implemented iteration for objects #4
Labels
closed-invalid
Closed as we don't believe the reported issue is generally actionable
Comments
This comment was originally written by antonm@google.com obj should be of type Map which doesn't implement Iterable. Please, try for (key in obj.getKeys()). Added Invalid label. |
DartBot
added
Type-Defect
closed-invalid
Closed as we don't believe the reported issue is generally actionable
labels
Oct 10, 2011
This was referenced Jun 3, 2015
This was referenced Jun 3, 2015
This was referenced Jun 3, 2015
Closed
This was referenced Jun 3, 2015
Closed
Closed
copybara-service bot
pushed a commit
that referenced
this issue
Oct 22, 2024
See: b/374689139. https://dart-review.googlesource.com/c/sdk/+/390941 is blocking an SDK roll. Root cause: ``` Action threw an exception: type 'ConstructorMember' is not a subtype of type 'ConstructorFragment' in type cast #0 InterfaceTypeImpl.constructors2.<anonymous closure> (package:analyzer/src/dart/element/type.dart:569) #1 MappedListIterable.elementAt (dart:_internal/iterable.dart:435) #2 ListIterator.moveNext (dart:_internal/iterable.dart:364) #3 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189) #4 new _GrowableList.of (dart:core-patch/growable_array.dart:150) #5 new List.of (dart:core-patch/array_patch.dart:39) #6 ListIterable.toList (dart:_internal/iterable.dart:224) #7 InterfaceTypeImpl.constructors2 (package:analyzer/src/dart/element/type.dart:570) #8 _Visitor._hasConstConstructorInvocation (package:linter/src/rules/prefer_const_constructors_in_immutables.dart:110) #9 _Visitor.visitConstructorDeclaration (package:linter/src/rules/prefer_const_constructors_in_immutables.dart:58) ``` To verify the fix locally: ``` solo_test_X() async { await assertNoErrorsInCode(r''' class A<T> {} '''); var A = findElement.class_('A').instantiate( typeArguments: [intType], nullabilitySuffix: NullabilitySuffix.none, ); A.constructors2; } ``` Bug: b/374689139 Change-Id: I70034d938d840dc0c3939db27e7116164e4617e9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391483 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Phil Quitslund <pquitslund@google.com>
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 vjeuxx...@gmail.com
What steps will reproduce the problem?
main() {
var obj = {"a": 1, "b": 2};
for (var key in obj) {
print(key);
}
}
http://try-dart-lang.appspot.com/s/EmEO
What is the expected output?
a
b
What do you see instead?
NoSuchMethodException - receiver: '' function name: 'iterator$named' arguments: []]
What version of the product are you using? On what operating system?
Online dart compiler.
Please provide any additional information below.
In the specification it says that "for in" construct is desugared into var n0 = e.iterator(); while (n0.hasNext()) { finalVarOrType id = n0.next();
It is not working because obj.iterator does not exist.
The text was updated successfully, but these errors were encountered: