ba92b78acd
Bug: https://github.com/dart-lang/sdk/issues/42821 Change-Id: I153c48d7a2e4a02026928e6203aacf8f2dc029ba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155849 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
23 lines
681 B
Dart
23 lines
681 B
Dart
// Copyright (c) 2014, 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.
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
int main() {
|
|
var a = [1, 2, 3][2];
|
|
switch (a) {
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.SWITCH_EXPRESSION_NOT_ASSIGNABLE
|
|
case 0.0:
|
|
// ^
|
|
// [cfe] Type 'int' of the switch expression isn't assignable to the type 'double' of this case expression.
|
|
print("illegal");
|
|
break;
|
|
case 1:
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.INCONSISTENT_CASE_EXPRESSION_TYPES
|
|
print("OK");
|
|
}
|
|
}
|