c191551fac
TEST=Covered by existing tests. Change-Id: Ied8be1874164e68e0a3a48e1b2f9a33310071381 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183009 Commit-Queue: Dmitry Stefantsov <dmitryas@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
59 lines
3.8 KiB
Plaintext
59 lines
3.8 KiB
Plaintext
library test;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/inference/map_literals.dart:12:46: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
|
|
// /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/inference/map_literals.dart:14:46: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
|
|
// /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u';
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/inference/map_literals.dart:15:60: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
|
|
// x /*@target=Map.[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/inference/map_literals.dart:27:46: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
|
|
// /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/inference/map_literals.dart:29:60: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
|
|
// - 'Pattern' is from 'dart:core'.
|
|
// x /*@target=Map.[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
static method test1() → dynamic {
|
|
core::Map<core::int*, core::String*>* x = <core::int*, core::String*>{1: "x", 2: "y"};
|
|
x.{core::Map::[]=}(3, "z");
|
|
x.{core::Map::[]=}(let final Never* #t1 = invalid-expression "pkg/front_end/testcases/inference/map_literals.dart:12:46: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
|
|
/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
|
|
^" in "hi" as{TypeError} core::int*, "w");
|
|
x.{core::Map::[]=}(let final Never* #t2 = invalid-expression "pkg/front_end/testcases/inference/map_literals.dart:14:46: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
|
|
/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u';
|
|
^" in 4.0 as{TypeError} core::int*, "u");
|
|
x.{core::Map::[]=}(3, let final Never* #t3 = invalid-expression "pkg/front_end/testcases/inference/map_literals.dart:15:60: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
|
|
x /*@target=Map.[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
|
|
^" in 42 as{TypeError} core::String*);
|
|
core::Map<core::num*, core::String*>* y = x;
|
|
}
|
|
static method test2() → dynamic {
|
|
core::Map<core::num*, core::Pattern*>* x = <core::num*, core::Pattern*>{1: "x", 2: "y", 3.0: core::RegExp::•(".")};
|
|
x.{core::Map::[]=}(3, "z");
|
|
x.{core::Map::[]=}(let final Never* #t4 = invalid-expression "pkg/front_end/testcases/inference/map_literals.dart:27:46: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
|
|
/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
|
|
^" in "hi" as{TypeError} core::num*, "w");
|
|
x.{core::Map::[]=}(4.0, "u");
|
|
x.{core::Map::[]=}(3, let final Never* #t5 = invalid-expression "pkg/front_end/testcases/inference/map_literals.dart:29:60: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
|
|
- 'Pattern' is from 'dart:core'.
|
|
x /*@target=Map.[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
|
|
^" in 42 as{TypeError} core::Pattern*);
|
|
core::Pattern* p = null;
|
|
x.{core::Map::[]=}(2, p);
|
|
core::Map<core::int*, core::String*>* y = x as{TypeError} core::Map<core::int*, core::String*>*;
|
|
}
|
|
static method main() → dynamic {}
|