File tree 3 files changed +39
-10
lines changed
Language/Expressions/Shift
LanguageFeatures/nnbd/triple-shift 3 files changed +39
-10
lines changed Original file line number Diff line number Diff line change 11
11
*/
12
12
// SharedOptions=--enable-experiment=triple-shift
13
13
14
+ import "../../../Utils/expect.dart" ;
15
+
14
16
main () {
15
17
int i1 = 12345 ;
16
18
int i2 = - 11 ;
17
19
int i3 = - 12345 ;
18
20
19
- var res1 = i1 >>> i2; //# 01: compile-time error
20
- var res2 = i1 >>> i3; //# 02: compile-time error
21
- var res3 = i2 >>> i3; //# 03: compile-time error
22
- var res4 = i3 >>> i2; //# 04: compile-time error
23
-
24
- var res5 = i1 >>> - 2 ; //# 05: compile-time error
25
- var res6 = 2000 >>> i3; //# 06: compile-time error
26
- var res7 = 2000 >>> - 14 ; //# 07: compile-time error
21
+ Expect .throws (() { i1 >>> i2; });
22
+ Expect .throws (() { i1 >>> i3; });
23
+ Expect .throws (() { i2 >>> i3; });
24
+ Expect .throws (() { i3 >>> i2; });
25
+ Expect .throws (() { i1 >>> - 2 ; });
26
+ Expect .throws (() { 2000 >>> i3; });
27
+ Expect .throws (() { 150 >>> - 14 ; });
27
28
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
3
+ * for details. All rights reserved. Use of this source code is governed by a
4
+ * BSD-style license that can be found in the LICENSE file.
5
+ */
6
+ /**
7
+ * @assertion N/A
8
+ * @description Checks that triple right shift argument cannot be negative and
9
+ * cause compile time error if this is a constant expression (see co19 Issue
10
+ * #355 for more details)
11
+
12
+ */
13
+ // SharedOptions=--enable-experiment=triple-shift
14
+
15
+ main () {
16
+ const int i1 = 12345 ;
17
+ const int i2 = - 11 ;
18
+ const int i3 = - 12345 ;
19
+
20
+ const res1 = i1 >>> i2; //# 01: compile-time error
21
+ const res2 = i1 >>> i3; //# 02: compile-time error
22
+ const res3 = i2 >>> i3; //# 03: compile-time error
23
+ const res4 = i3 >>> i2; //# 04: compile-time error
24
+
25
+ const res5 = i1 >>> - 2 ; //# 05: compile-time error
26
+ const res6 = 2000 >>> i3; //# 06: compile-time error
27
+ const res7 = 2000 >>> - 14 ; //# 07: compile-time error
28
+ }
Original file line number Diff line number Diff line change @@ -23,13 +23,13 @@ main() {
23
23
if (b) {
24
24
x = 42 ;
25
25
}
26
- x >>> = 2 ;
26
+ x >>> = 2 ;
27
27
Expect .equals (42 >>> 2 , x);
28
28
29
29
var y;
30
30
b = false ;
31
31
if (b) {
32
32
y = 42 ;
33
33
}
34
- Expect .throws (() {x >>> = 2 ;});
34
+ Expect .throws (() {y >>> = 2 ;});
35
35
}
You can’t perform that action at this time.
0 commit comments