blob: 0f21a2c92d461500b4ce6c474ee005b06c2246eb [file] [log] [blame] [edit]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library test;
test1() {
var x = {1: 'x', 2: 'y'};
x[3] = 'z';
x[ /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
x[ /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u';
x[3] = /*error:INVALID_ASSIGNMENT*/ 42;
Map<num, String> y = x;
}
test2(Pattern p) {
var x = {1: 'x', 2: 'y', 3.0: new RegExp('.')};
x[3] = 'z';
x[ /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
x[4.0] = 'u';
x[3] = /*error:INVALID_ASSIGNMENT*/ 42;
x[2] = p;
Map<int, String> y = /*error:INVALID_ASSIGNMENT*/ x;
}
main() {}