mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:47:13 +00:00
0284fdab6b
The CFE doesn't allow them explicitly yet, but implicit casts do show up by the time we see them in dart2js. Closes https://github.com/dart-lang/sdk/issues/32773 Change-Id: Idb566625ce7c8edc74a4eea0109491bd72357051 Reviewed-on: https://dart-review.googlesource.com/49801 Commit-Queue: Sigmund Cherem <sigmund@google.com> Reviewed-by: Stephen Adams <sra@google.com>
17 lines
485 B
Dart
17 lines
485 B
Dart
// Copyright (c) 2018, 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.
|
|
|
|
/// Implicit casts in constants are supported and treated as compile-time errors
|
|
/// if they are not valid.
|
|
|
|
class A {
|
|
final int n;
|
|
const A(dynamic input) : n = input;
|
|
}
|
|
|
|
main() {
|
|
print(const A(2)); //# 01: ok
|
|
print(const A('2')); //# 02: compile-time error
|
|
}
|