Skip to content

Constant list/map is modifiable #29897

@vsmenon

Description

@vsmenon

The following does not throw in DDC.

void main() {
  List<String> list = const [];
  list.add("hello");
  print(list);
}

On the VM, it generates:

Unhandled exception:
Unsupported operation: Cannot add to an unmodifiable list

EDIT(jmesserly): Maps need to be fixed as well

Metadata

Metadata

Assignees

Labels

type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)web-dev-compiler

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions