Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Polymer ternary expression causes error when testing equality #17805

Closed
DartBot opened this Issue Mar 26, 2014 · 9 comments

Comments

Projects
None yet
5 participants

DartBot commented Mar 26, 2014

This issue was originally filed by @tomaszkubacki


Attached project shows the issue tested against:
polymer expressions 0.10.0-pre.0
on
Dart Editor version 1.3.0.dev_06_01 (DEV)
Dart SDK version 1.3.0-dev.6.1

Lets assume we have:

@customtag('test-ternary-expression')
class TestTernaryExpression extends PolymerElement {
     
  @­observable Item selectedItem = new Item()..id = 1;
  
  @­observable List<Item> items = toObservable([
                                                   new Item()..id = 0,
                                                   new Item()..id = 1,
                                                   new Item()..id = 2]);
  TestTernaryExpression.created() : super.created() {}
}

class Item {
  
  @­observable int id = -1;
  
  String toString() => id.toString();
  
}

and

 <template repeat="{{item in items}}" >
      <div class="{{selectedItem.id == item.id ? 'active':''}}">
         {{item}}
      </div>
    </template>

this will result in:

/opt/dart/chromium/chrome --remote-debugging-port=33762 --user-data-dir=/home/tomek/.dartium --enable-experimental-web-platform-features --enable-html-imports --no-first-run --no-default-browser-check --no-process-singleton-dialog chrome://version/
Exception: type 'int' is not a subtype of type 'bool' of 'boolean expression'. (package:polymer_expressions/eval.dart:551)
Uncaught Error: RangeError: 0
Stack Trace:

­0 List.

­1 _TemplateIterator._getTerminatorAt (package:template_binding/src/template_iterator.dart:327:34)

­2 _TemplateIterator._extractInstanceAt (package:template_binding/src/template_iterator.dart:369:38)

­3 _TemplateIterator._handleSplices (package:template_binding/src/template_iterator.dart:413:50)

­4 _TemplateIterator._valueChanged (package:template_binding/src/template_iterator.dart:320:19)

­5 _updateIteratedValue (package:template_binding/src/template_iterator.dart:293:18)

­6 _setValue (package:polymer_expressions/polymer_expressions.dart:129:37)

­7 dirtyCheckZoneSpec.wrapUnaryCallback.<anonymous closure> (package:observe/src/dirty_check.dart:120:15)

­8 _rootRunUnary (dart:async/zone.dart:717)

­9 _ZoneDelegate.runUnary (dart:async/zone.dart:449)

­10 _CustomizedZone.runUnary (dart:async/zone.dart:654)

­11 _BaseZone.runUnaryGuarded (dart:async/zone.dart:569)

­12 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)

­13 _DelayedData.perform (dart:async/stream_impl.dart:585)

­14 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:701)

­15 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:661)

­16 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)

­17 _rootRun (dart:async/zone.dart:706)

­18 _ZoneDelegate.run (dart:async/zone.dart:440)

­19 _CustomizedZone.run (dart:async/zone.dart:650)

­20 _BaseZone.runGuarded (dart:async/zone.dart:561)

­21 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:586)

­22 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)

­23 _rootRun (dart:async/zone.dart:710)

­24 _ZoneDelegate.run (dart:async/zone.dart:440)

­25 _CustomizedZone.run (dart:async/zone.dart:650)

­26 _BaseZone.runGuarded (dart:async/zone.dart:561)

­27 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:586)

­28 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:23)

­29 _asyncRunCallback (dart:async/schedule_microtask.dart:32)

­30 _handleMutation (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:621)

Exception: RangeError: 0


Attachment:
testTernary.zip (3.20 KB)

Member

lrhn commented Mar 26, 2014

Added Area-Polymer, Triaged labels.

Member

jmesserly commented Apr 1, 2014

from the callstack, it looks like there was another error previously. Do you see anything if you open the web inspector console in Dartium?

Another thing to try: "pub upgrade", in 0.10.0-pre.5, that callstack shouldn't happen after an earlier exception

Member

sigmundch commented Apr 1, 2014

Hey Tomasz,

I was also not able to reproduce the error. I just tried the example you attached with polymer 0.10.0-pre.5 and it seems to be working. Let us know if it's working for you as well.


Added NeedsInfo label.

DartBot commented Apr 1, 2014

This comment was originally written by @tomaszkubacki


Now on Ubuntu 14.04 64bit
Java 8
Dart Editor version 1.3.0.dev_07_05 (DEV)
Dart SDK version 1.3.0-dev.7.5
Polymer 0.10.0-pre.5

run: /opt/dart/chromium/chrome --remote-debugging-port=46757 --user-data-dir=/home/tomek/.dartium --enable-experimental-web-platform-features --enable-html-imports --no-first-run --no-default-browser-check --no-process-singleton-dialog chrome://version/

and whole log on debug from dartium console:

Uncaught Error: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Stack Trace:
#­0 TernaryObserver._updateSelf (package:polymer_expressions/eval.dart:602:21)
#­1 ExpressionObserver._observe (package:polymer_expressions/eval.dart:307:16)
#­2 Updater.visitExpression (package:polymer_expressions/eval.dart:323:15)
#­3 RecursiveVisitor.visitTernaryOperator (package:polymer_expressions/visitor.dart:117:20)
#­4 TernaryObserver.accept (package:polymer_expressions/eval.dart:605:46)
#­5 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­6 RecursiveVisitor.visitBinaryOperator (package:polymer_expressions/visitor.dart:102:10)
#­7 BinaryObserver.accept (package:polymer_expressions/eval.dart:587:45)
#­8 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­9 update (package:polymer_expressions/eval.dart:71:27)
#­10 _Binding.open (package:polymer_expressions/polymer_expressions.dart:166:13)
#­11 NodeBindExtension._open (package:template_binding/src/node.dart:65:29)
#­12 _ElementExtension.bind (package:template_binding/src/element.dart:32:12)
#­13 _processBindings (package:template_binding/src/template_iterator.dart:186:38)
#­14 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#­15 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#­16 _TemplateIterator._handleSplices (package:template_binding/src/template_iterator.dart:449:53)
#­17 _TemplateIterator._valueChanged (package:template_binding/src/template_iterator.dart:330:19)
#­18 _TemplateIterator._updateIteratedValue (package:template_binding/src/template_iterator.dart:303:18)
#­19 _TemplateIterator._updateDependencies (package:template_binding/src/template_iterator.dart:287:25)
#­20 TemplateBindExtension._processBindingDirectives (package:template_binding/src/template.dart:50:34)
#­21 _processBindings (package:template_binding/src/template_iterator.dart:197:51)
#­22 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#­23 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:60:26)
#­24 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#­25 HtmlElement&Polymer.instanceTemplate (package:polymer/src/instance.dart:410:44)
#­26 HtmlElement&Polymer.shadowFromTemplate (package:polymer/src/instance.dart:268:31)
#­27 HtmlElement&Polymer.parseDeclaration (package:polymer/src/instance.dart:208:34)
#­28 HtmlElement&Polymer.parseDeclarations (package:polymer/src/instance.dart:195:23)
#­29 HtmlElement&Polymer.prepareElement (package:polymer/src/instance.dart:170:22)
#­30 HtmlElement&Polymer.polymerCreated (package:polymer/src/instance.dart:145:21)
#­31 PolymerElement.PolymerElement.created (package:polymer/src/instance.dart:962:19)
#­32 TestTernaryExpression.TestTernaryExpression.created (http://127.0.0.1:3030/testTernary/web/test_ternary_expression.dart:13:37)
#­33 _Utils._register (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:452)
#­34 _Utils.register (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:448)
#­35 HtmlDocument.register (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/out/Release/gen/blink/bindings/dart/dart/html/HtmlDocument.dart:262)
#­36 PolymerDeclaration.registerType (package:polymer/src/declaration.dart:163:22)
#­37 PolymerDeclaration.register (package:polymer/src/declaration.dart:81:17)
#­38 _hookJsPolymer.registerDart.<anonymous closure> (package:polymer/src/loader.dart:102:75)
#­39 _rootRun (dart:async/zone.dart:719)
#­40 _ZoneDelegate.run (dart:async/zone.dart:453)
#­41 _CustomizedZone.run (dart:async/zone.dart:663)
#­42 _hookJsPolymer.registerDart (package:polymer/src/loader.dart:101:22)
#­43 JsFunction.apply (dart:js:254)
#­44 Polymer.register (package:polymer/src/instance.dart:79:48)
#­45 _loadCustomTags.<anonymous closure>.<anonymous closure> (package:polymer/src/mirror_loader.dart:181:29)
#­46 _initPolymerOptimized (package:polymer/src/loader.dart:44:16)
#­47 _rootRun (dart:async/zone.dart:723)
#­48 _ZoneDelegate.run (dart:async/zone.dart:453)
#­49 _CustomizedZone.run (dart:async/zone.dart:663)
#­50 initPolymer (package:polymer/src/loader.dart:33:55)
#­51 main (package:polymer/init.dart:21:22)

Exception: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Uncaught Error: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Stack Trace:
#­0 TernaryObserver._updateSelf (package:polymer_expressions/eval.dart:602:21)
#­1 ExpressionObserver._observe (package:polymer_expressions/eval.dart:307:16)
#­2 Updater.visitExpression (package:polymer_expressions/eval.dart:323:15)
#­3 RecursiveVisitor.visitTernaryOperator (package:polymer_expressions/visitor.dart:117:20)
#­4 TernaryObserver.accept (package:polymer_expressions/eval.dart:605:46)
#­5 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­6 RecursiveVisitor.visitBinaryOperator (package:polymer_expressions/visitor.dart:102:10)
#­7 BinaryObserver.accept (package:polymer_expressions/eval.dart:587:45)
#­8 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­9 update (package:polymer_expressions/eval.dart:71:27)
#­10 _Binding.open (package:polymer_expressions/polymer_expressions.dart:166:13)
#­11 NodeBindExtension._open (package:template_binding/src/node.dart:65:29)
#­12 _ElementExtension.bind (package:template_binding/src/element.dart:32:12)
#­13 _processBindings (package:template_binding/src/template_iterator.dart:186:38)
#­14 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#­15 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#­16 _TemplateIterator._handleSplices (package:template_binding/src/template_iterator.dart:449:53)
#­17 _TemplateIterator._valueChanged (package:template_binding/src/template_iterator.dart:330:19)
#­18 _TemplateIterator._updateIteratedValue (package:template_binding/src/template_iterator.dart:303:18)
#­19 _TemplateIterator._updateDependencies (package:template_binding/src/template_iterator.dart:287:25)
#­20 TemplateBindExtension._processBindingDirectives (package:template_binding/src/template.dart:50:34)
#­21 _processBindings (package:template_binding/src/template_iterator.dart:197:51)
#­22 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#­23 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:60:26)
#­24 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#­25 HtmlElement&Polymer.instanceTemplate (package:polymer/src/instance.dart:410:44)
#­26 HtmlElement&Polymer.shadowFromTemplate (package:polymer/src/instance.dart:268:31)
#­27 HtmlElement&Polymer.parseDeclaration (package:polymer/src/instance.dart:208:34)
#­28 HtmlElement&Polymer.parseDeclarations (package:polymer/src/instance.dart:195:23)
#­29 HtmlElement&Polymer.prepareElement (package:polymer/src/instance.dart:170:22)
#­30 HtmlElement&Polymer.polymerCreated (package:polymer/src/instance.dart:145:21)
#­31 PolymerElement.PolymerElement.created (package:polymer/src/instance.dart:962:19)
#­32 TestTernaryExpression.TestTernaryExpression.created (http://127.0.0.1:3030/testTernary/web/test_ternary_expression.dart:13:37)
#­33 _Utils._register (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:452)
#­34 _Utils.register (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:448)
#­35 HtmlDocument.register (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/out/Release/gen/blink/bindings/dart/dart/html/HtmlDocument.dart:262)
#­36 PolymerDeclaration.registerType (package:polymer/src/declaration.dart:163:22)
#­37 PolymerDeclaration.register (package:polymer/src/declaration.dart:81:17)
#­38 _hookJsPolymer.registerDart.<anonymous closure> (package:polymer/src/loader.dart:102:75)
#­39 _rootRun (dart:async/zone.dart:719)
#­40 _ZoneDelegate.run (dart:async/zone.dart:453)
#­41 _CustomizedZone.run (dart:async/zone.dart:663)
#­42 _hookJsPolymer.registerDart (package:polymer/src/loader.dart:101:22)
#­43 JsFunction.apply (dart:js:254)
#­44 Polymer.register (package:polymer/src/instance.dart:79:48)
#­45 _loadCustomTags.<anonymous closure>.<anonymous closure> (package:polymer/src/mirror_loader.dart:181:29)
#­46 _initPolymerOptimized (package:polymer/src/loader.dart:44:16)
#­47 _rootRun (dart:async/zone.dart:723)
#­48 _ZoneDelegate.run (dart:async/zone.dart:453)
#­49 _CustomizedZone.run (dart:async/zone.dart:663)
#­50 initPolymer (package:polymer/src/loader.dart:33:55)
#­51 main (package:polymer/init.dart:21:22)

Exception: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Uncaught Error: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Stack Trace:
#­0 TernaryObserver._updateSelf (package:polymer_expressions/eval.dart:602:21)
#­1 ExpressionObserver._observe (package:polymer_expressions/eval.dart:307:16)
#­2 Updater.visitExpression (package:polymer_expressions/eval.dart:323:15)
#­3 RecursiveVisitor.visitTernaryOperator (package:polymer_expressions/visitor.dart:117:20)
#­4 TernaryObserver.accept (package:polymer_expressions/eval.dart:605:46)
#­5 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­6 RecursiveVisitor.visitBinaryOperator (package:polymer_expressions/visitor.dart:102:10)
#­7 BinaryObserver.accept (package:polymer_expressions/eval.dart:587:45)
#­8 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­9 update (package:polymer_expressions/eval.dart:71:27)
#­10 _Binding.open (package:polymer_expressions/polymer_expressions.dart:166:13)
#­11 NodeBindExtension._open (package:template_binding/src/node.dart:65:29)
#­12 _ElementExtension.bind (package:template_binding/src/element.dart:32:12)
#­13 _processBindings (package:template_binding/src/template_iterator.dart:186:38)
#­14 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#­15 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#­16 _TemplateIterator._handleSplices (package:template_binding/src/template_iterator.dart:449:53)
#­17 _TemplateIterator._valueChanged (package:template_binding/src/template_iterator.dart:330:19)
#­18 _TemplateIterator._updateIteratedValue (package:template_binding/src/template_iterator.dart:303:18)
#­19 _TemplateIterator._updateDependencies (package:template_binding/src/template_iterator.dart:287:25)
#­20 TemplateBindExtension._processBindingDirectives (package:template_binding/src/template.dart:50:34)
#­21 _processBindings (package:template_binding/src/template_iterator.dart:197:51)
#­22 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#­23 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:60:26)
#­24 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#­25 HtmlElement&Polymer.instanceTemplate (package:polymer/src/instance.dart:410:44)
#­26 HtmlElement&Polymer.shadowFromTemplate (package:polymer/src/instance.dart:268:31)
#­27 HtmlElement&Polymer.parseDeclaration (package:polymer/src/instance.dart:208:34)
#­28 HtmlElement&Polymer.parseDeclarations (package:polymer/src/instance.dart:195:23)
#­29 HtmlElement&Polymer.prepareElement (package:polymer/src/instance.dart:170:22)
#­30 HtmlElement&Polymer.polymerCreated (package:polymer/src/instance.dart:145:21)
#­31 PolymerElement.PolymerElement.created (package:polymer/src/instance.dart:962:19)
#­32 TestTernaryExpression.TestTernaryExpression.created (http://127.0.0.1:3030/testTernary/web/test_ternary_expression.dart:13:37)
#­33 _Utils._register (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:452)
#­34 _Utils.register (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:448)
#­35 HtmlDocument.register (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/out/Release/gen/blink/bindings/dart/dart/html/HtmlDocument.dart:262)
#­36 PolymerDeclaration.registerType (package:polymer/src/declaration.dart:163:22)
#­37 PolymerDeclaration.register (package:polymer/src/declaration.dart:81:17)
#­38 _hookJsPolymer.registerDart.<anonymous closure> (package:polymer/src/loader.dart:102:75)
#­39 _rootRun (dart:async/zone.dart:719)
#­40 _ZoneDelegate.run (dart:async/zone.dart:453)
#­41 _CustomizedZone.run (dart:async/zone.dart:663)
#­42 _hookJsPolymer.registerDart (package:polymer/src/loader.dart:101:22)
#­43 JsFunction.apply (dart:js:254)
#­44 Polymer.register (package:polymer/src/instance.dart:79:48)
#­45 _loadCustomTags.<anonymous closure>.<anonymous closure> (package:polymer/src/mirror_loader.dart:181:29)
#­46 _initPolymerOptimized (package:polymer/src/loader.dart:44:16)
#­47 _rootRun (dart:async/zone.dart:723)
#­48 _ZoneDelegate.run (dart:async/zone.dart:453)
#­49 _CustomizedZone.run (dart:async/zone.dart:663)
#­50 initPolymer (package:polymer/src/loader.dart:33:55)
#­51 main (package:polymer/init.dart:21:22)

Exception: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Uncaught Error: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Stack Trace:
#­0 TernaryObserver._updateSelf (package:polymer_expressions/eval.dart:602:21)
#­1 ExpressionObserver._observe (package:polymer_expressions/eval.dart:307:16)
#­2 Updater.visitExpression (package:polymer_expressions/eval.dart:323:15)
#­3 RecursiveVisitor.visitTernaryOperator (package:polymer_expressions/visitor.dart:117:20)
#­4 TernaryObserver.accept (package:polymer_expressions/eval.dart:605:46)
#­5 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­6 RecursiveVisitor.visitBinaryOperator (package:polymer_expressions/visitor.dart:102:10)
#­7 BinaryObserver.accept (package:polymer_expressions/eval.dart:587:45)
#­8 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­9 update (package:polymer_expressions/eval.dart:71:27)
#­10 _Binding.open (package:polymer_expressions/polymer_expressions.dart:166:13)
#­11 NodeBindExtension._open (package:template_binding/src/node.dart:65:29)
#­12 _ElementExtension.bind (package:template_binding/src/element.dart:32:12)
#­13 _processBindings (package:template_binding/src/template_iterator.dart:186:38)
#­14 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#­15 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#­16 _TemplateIterator._handleSplices (package:template_binding/src/template_iterator.dart:449:53)
#­17 _TemplateIterator._valueChanged (package:template_binding/src/template_iterator.dart:330:19)
#­18 _updateIteratedValue (package:template_binding/src/template_iterator.dart:303:18)
#­19 _setValue (package:polymer_expressions/polymer_expressions.dart:127:37)
#­20 dirtyCheckZoneSpec.wrapUnaryCallback.<anonymous closure> (package:observe/src/dirty_check.dart:120:15)
#­21 _rootRunUnary (dart:async/zone.dart:730)
#­22 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#­23 _CustomizedZone.runUnary (dart:async/zone.dart:667)
#­24 _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
#­25 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
#­26 _DelayedData.perform (dart:async/stream_impl.dart:585)
#­27 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:701)
#­28 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:661)
#­29 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)
#­30 _rootRun (dart:async/zone.dart:719)
#­31 _ZoneDelegate.run (dart:async/zone.dart:453)
#­32 _CustomizedZone.run (dart:async/zone.dart:663)
#­33 _BaseZone.runGuarded (dart:async/zone.dart:574)
#­34 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:599)
#­35 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)
#­36 _rootRun (dart:async/zone.dart:723)
#­37 _ZoneDelegate.run (dart:async/zone.dart:453)
#­38 _CustomizedZone.run (dart:async/zone.dart:663)
#­39 _BaseZone.runGuarded (dart:async/zone.dart:574)
#­40 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:599)
#­41 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:23)
#­42 _asyncRunCallback (dart:async/schedule_microtask.dart:32)
#­43 _handleMutation (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:624)

Exception: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Uncaught Error: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Stack Trace:
#­0 TernaryObserver._updateSelf (package:polymer_expressions/eval.dart:602:21)
#­1 ExpressionObserver._observe (package:polymer_expressions/eval.dart:307:16)
#­2 Updater.visitExpression (package:polymer_expressions/eval.dart:323:15)
#­3 RecursiveVisitor.visitTernaryOperator (package:polymer_expressions/visitor.dart:117:20)
#­4 TernaryObserver.accept (package:polymer_expressions/eval.dart:605:46)
#­5 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­6 RecursiveVisitor.visitBinaryOperator (package:polymer_expressions/visitor.dart:102:10)
#­7 BinaryObserver.accept (package:polymer_expressions/eval.dart:587:45)
#­8 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­9 update (package:polymer_expressions/eval.dart:71:27)
#­10 _Binding.open (package:polymer_expressions/polymer_expressions.dart:166:13)
#­11 NodeBindExtension._open (package:template_binding/src/node.dart:65:29)
#­12 _ElementExtension.bind (package:template_binding/src/element.dart:32:12)
#­13 _processBindings (package:template_binding/src/template_iterator.dart:186:38)
#­14 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#­15 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#­16 _TemplateIterator._handleSplices (package:template_binding/src/template_iterator.dart:449:53)
#­17 _TemplateIterator._valueChanged (package:template_binding/src/template_iterator.dart:330:19)
#­18 _updateIteratedValue (package:template_binding/src/template_iterator.dart:303:18)
#­19 _setValue (package:polymer_expressions/polymer_expressions.dart:127:37)
#­20 dirtyCheckZoneSpec.wrapUnaryCallback.<anonymous closure> (package:observe/src/dirty_check.dart:120:15)
#­21 _rootRunUnary (dart:async/zone.dart:730)
#­22 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#­23 _CustomizedZone.runUnary (dart:async/zone.dart:667)
#­24 _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
#­25 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
#­26 _DelayedData.perform (dart:async/stream_impl.dart:585)
#­27 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:701)
#­28 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:661)
#­29 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)
#­30 _rootRun (dart:async/zone.dart:719)
#­31 _ZoneDelegate.run (dart:async/zone.dart:453)
#­32 _CustomizedZone.run (dart:async/zone.dart:663)
#­33 _BaseZone.runGuarded (dart:async/zone.dart:574)
#­34 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:599)
#­35 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)
#­36 _rootRun (dart:async/zone.dart:723)
#­37 _ZoneDelegate.run (dart:async/zone.dart:453)
#­38 _CustomizedZone.run (dart:async/zone.dart:663)
#­39 _BaseZone.runGuarded (dart:async/zone.dart:574)
#­40 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:599)
#­41 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:23)
#­42 _asyncRunCallback (dart:async/schedule_microtask.dart:32)
#­43 _handleMutation (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:624)

Exception: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Uncaught Error: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.
Stack Trace:
#­0 TernaryObserver._updateSelf (package:polymer_expressions/eval.dart:602:21)
#­1 ExpressionObserver._observe (package:polymer_expressions/eval.dart:307:16)
#­2 Updater.visitExpression (package:polymer_expressions/eval.dart:323:15)
#­3 RecursiveVisitor.visitTernaryOperator (package:polymer_expressions/visitor.dart:117:20)
#­4 TernaryObserver.accept (package:polymer_expressions/eval.dart:605:46)
#­5 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­6 RecursiveVisitor.visitBinaryOperator (package:polymer_expressions/visitor.dart:102:10)
#­7 BinaryObserver.accept (package:polymer_expressions/eval.dart:587:45)
#­8 Visitor.visit (package:polymer_expressions/visitor.dart:10:34)
#­9 update (package:polymer_expressions/eval.dart:71:27)
#­10 _Binding.open (package:polymer_expressions/polymer_expressions.dart:166:13)
#­11 NodeBindExtension._open (package:template_binding/src/node.dart:65:29)
#­12 _ElementExtension.bind (package:template_binding/src/element.dart:32:12)
#­13 _processBindings (package:template_binding/src/template_iterator.dart:186:38)
#­14 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#­15 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#­16 _TemplateIterator._handleSplices (package:template_binding/src/template_iterator.dart:449:53)
#­17 _TemplateIterator._valueChanged (package:template_binding/src/template_iterator.dart:330:19)
#­18 _updateIteratedValue (package:template_binding/src/template_iterator.dart:303:18)
#­19 _setValue (package:polymer_expressions/polymer_expressions.dart:127:37)
#­20 dirtyCheckZoneSpec.wrapUnaryCallback.<anonymous closure> (package:observe/src/dirty_check.dart:120:15)
#­21 _rootRunUnary (dart:async/zone.dart:730)
#­22 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#­23 _CustomizedZone.runUnary (dart:async/zone.dart:667)
#­24 _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
#­25 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
#­26 _DelayedData.perform (dart:async/stream_impl.dart:585)
#­27 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:701)
#­28 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:661)
#­29 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)
#­30 _rootRun (dart:async/zone.dart:719)
#­31 _ZoneDelegate.run (dart:async/zone.dart:453)
#­32 _CustomizedZone.run (dart:async/zone.dart:663)
#­33 _BaseZone.runGuarded (dart:async/zone.dart:574)
#­34 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:599)
#­35 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)
#­36 _rootRun (dart:async/zone.dart:723)
#­37 _ZoneDelegate.run (dart:async/zone.dart:453)
#­38 _CustomizedZone.run (dart:async/zone.dart:663)
#­39 _BaseZone.runGuarded (dart:async/zone.dart:574)
#­40 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:599)
#­41 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:23)
#­42 _asyncRunCallback (dart:async/schedule_microtask.dart:32)
#­43 _handleMutation (file:///mnt/data/b/build/slave/dartium-lucid64-full-dev/build/src/dart/tools/dom/src/native_DOMImplementation.dart:624)

Exception: Error evaluating expression '(selectedItem.id == (item.id ? "active" : ""))': type 'int' is not a subtype of type 'bool' of 'boolean expression'.subtype of type 'bool' of 'boolean expression'.

Member

sigmundch commented Apr 2, 2014

Ah, thank you! I'm repro-ing it now. Totally forgot to include the --checked mode flag.

Member

sigmundch commented Apr 2, 2014

ok - it seems that the problem here is that polymer-expressions has a different associativity of operators than the one in Dart. If you add parenthesis, it should work for you:

(selectedItem.id == item.id) ? "active" : ""

you can actually see that the error message includes parenthesis of how it parsed the expression, and they are in the wrong place.


Added Triaged label.

Member

sigmundch commented Apr 2, 2014

Fixed in https://code.google.com/p/dart/source/detail?r=34628. It should be in the next release of polymer_expressions, but in the meantime, feel free to use parenthesis to work around it.


Added Fixed label.

DartBot commented Apr 2, 2014

This comment was originally written by @tomaszkubacki


Thank you for fixing and work around solution :)

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment