Merge remote-tracking branch 'origin/master' into reosablo.suggestion-for-CanonicalizedMap-spec
diff --git a/lib/src/canonicalized_map.dart b/lib/src/canonicalized_map.dart
index 7ee3f86..21fb83d 100644
--- a/lib/src/canonicalized_map.dart
+++ b/lib/src/canonicalized_map.dart
@@ -64,6 +64,7 @@
   }
 
   void operator []=(K key, V value) {
+    if (!_isValidKey(key)) return;
     _base[_canonicalize(key)] = new Pair(key, value);
   }
 
diff --git a/test/canonicalized_map_test.dart b/test/canonicalized_map_test.dart
index f5f009b..1bfeb2b 100644
--- a/test/canonicalized_map_test.dart
+++ b/test/canonicalized_map_test.dart
@@ -22,6 +22,15 @@
       expect(map["foo"], isNull);
     });
 
+    test("set affects nothing for uncanonicalizable key", () {
+      expect(() {
+        map["foo"] = "value";
+      }, returnsNormally);
+      expect(map["foo"], isNull);
+      expect(map.containsKey("foo"), isFalse);
+      expect(map.length, equals(0));
+    });
+
     test("canonicalizes keys for addAll", () {
       map.addAll({
         "1": "value 1",