Closed DartBot closed 9 years ago
Comment by butlermatt
Updated some libraries (html5lib, observe, shadow_dom) to 0.9.1 and error persists.
Comment by butlermatt
This appears to be caused in my polymer-element markup where I was using the polymer expression:
<template if="{{ list.length == 0 }}"> ... </template>
I know recently observe was updated to 0.9.1 which supposedly fixed issues with list.isEmpty and isNotEmpty from within polymer expressions but it appears the .length property was not similarly updated.
For what it's worth, I have observe 0.9.1 and encounter the same error using the list.isEmpty property as well. (However polymer and polymer expressions are still 0.9.0 as polymer expressions 0.9.1 has not yet landed on pub (polymer 0.9.1 has but requires 0.9.1 so it's not a valid upgrade path).
Comment by kasperl
Not sure if this is an issue with ObservableList or dart2js.
Added Library-Observe, Triaged labels.
Comment by sigmundch
Hey Matt, what is the type of 'list' in that expression (ObservableList or normal List?). Does this continue to happen if you get all at version 0.9.1 (now that they are actually uploaded)?
Comment by butlermatt
I think what happened was that the variable list is initially passed a normal List, but then I reassign it as an ObservableList. However obviously it fails soon as the List is passed to it, even before I have a chance to convert it to an ObservableList. I have a work around in place assigning the value from within dart code as opposed to within Polymer Expressions so feel free to close as wontfix/invalid.
Comment by jmesserly
Thanks Matt.
I'm still investigating ways to make this better. You should be able to include things like List.length too.
https://code.google.com/p/dart/issues/detail?id=15334
Added AssumedStale label.
Issue by butlermatt Originally opened as dart-lang/sdk#15283
Trying to get the length of an ObservableList, works in Dart. When compiled to Javascript my console shows errors:
Uncaught Unsupported operation: Can't use 'length' in reflection because it is not included in a @MirrorsUsed annotation. reports.html_bootstrap.dart.js:2414 wrapException reports.html_bootstrap.dart.js:2414 _rootHandleUncaughtError__closure.call$0 reports.html_bootstrap.dart.js:9488 _asyncRunCallback reports.html_bootstrap.dart.js:6871 TimerImpl_internalCallback0.call$0 reports.html_bootstrap.dart.js:2039 invokeClosure_closure.call$0 reports.html_bootstrap.dart.js:3576 _IsolateContext.eval$1 reports.html_bootstrap.dart.js:1363 _callInIsolate reports.html_bootstrap.dart.js:1111 invokeClosure reports.html_bootstrap.dart.js:2555 (anonymous function) reports.html_bootstrap.dart.js:2575 Uncaught Error: Unsupported operation: Can't use 'length' in reflection because it is not included in a @MirrorsUsed annotation. reports.html_bootstrap.dart.js:4087 Stack Trace: Error at Object.wrapException (http://<myHost>/reports/reports.html_bootstrap.dart.js:2414:13) at Object.throwInvalidReflectionError (http://<myHost>/reports/reports.html_bootstrap.dart.js:2077:11) at JSInvocationMirror._getCachedInvocation$1 (http://<myHost>/reports/reports.html_bootstrap.dart.js:3322:11) at JsInstanceMirror._invoke$4 (http://<myHost>/reports/reports.html_bootstrap.dart.js:5589:31) at JsInstanceMirror.getField$1 (http://<myHost>/reports/reports.html_bootstrap.dart.js:5609:17) at InvokeObserver._updateSelf$1 (http://<myHost>/reports/reports.html_bootstrap.dart.js:22622:74) at InvokeObserver.ExpressionObserver._observe$1 (http://<myHost>/reports/reports.html_bootstrap.dart.js:22264:10) at InvokeObserver.ExpressionObserver._invalidate$1 (http://<myHost>/reports/reports.html_bootstrap.dart.js:22251:10) at IdentifierObserver.ExpressionObserver._invalidate$1 (http://<myHost>/reports/reports.html_bootstrap.dart.js:22254:10) at IdentifierObserver__updateSelf_closure.call$1 (http://<myHost>/reports/reports.html_bootstrap.dart.js:22497:19)
My Environment: Dart Editor version 1.0.0_r30338 (DEV) Dart SDK version 1.0.0.7_r30338 Linux 64-Bit.
Packages: Polymer (and company) 0.9.0.