mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 14:53:37 +00:00
0eb13c95ac
The "@compile-error" comment is an old not-great way of defining static error tests. See: https://github.com/dart-lang/sdk/issues/45634 Change-Id: I42d3712f2f75f66e7ecae19f740de16f6025b41d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296120 Commit-Queue: Bob Nystrom <rnystrom@google.com> Reviewed-by: Leaf Petersen <leafp@google.com>
18 lines
531 B
Dart
18 lines
531 B
Dart
// 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.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
void main() {
|
|
testIllegalArgument();
|
|
}
|
|
|
|
void testIllegalArgument() {
|
|
String a = "Hello";
|
|
var c = a[2.2];
|
|
// ^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
|
// [cfe] A value of type 'double' can't be assigned to a variable of type 'int'.
|
|
}
|