Skip to content

Inconsistent behavior between VM and Dart2JS #7488

Closed
@gramster

Description

@gramster

Consider the following program:

main() {
  bugbug(2.0);
}

bugbug(x) {
  print(x);
  List l = [ 0, 1, 2];
  print (l[x]);
}

With dart2js, we get:

2
2

In the VM, we get:

2.0
Exception: type 'double' is not a subtype of type 'int' of 'index'.

I'm guessing that the VM is right, so I'm putting this in the dart2js area, although I prefer the behavior of dart2js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions