[3.0 alpha] Remove deprecated CastError and FallThroughError dart:core errors

TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I52495d3e5319f0555714f4f8247149afc06128a1
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,dart-sdk-linux-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259041
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Michael Thomsen 2022-12-15 13:38:47 +00:00 committed by Commit Queue
parent 2274ce9b05
commit bcbf24ec3d
13 changed files with 20 additions and 106 deletions

View file

@ -15,6 +15,13 @@
were only used internally during the Dart 2.0 development process.
- Removed the deprecated [`Deprecated.expires`][] getter.
Use [`Deprecated.message`][] instead.
- Removed the deprecated [`CastError`][] error.
Use [`TypeError`][] instead.
- Removed the deprecated [`FallThroughError`][] error. The kind of
fall-through previously throwing this error was made a compile-time
error in Dart 2.0.
- Removed the deprecated [`AbstractClassInstantiationError`][] error. It was made
a compile-time error to call the constructor of an abstract class in Dart 2.0.
[#49529]: https://github.com/dart-lang/sdk/issues/49529
[`int.parse`]: https://api.dart.dev/stable/2.18.4/dart-core/int/parse.html
@ -28,6 +35,10 @@
[`Provisional`]: https://api.dart.dev/stable/2.18.4/dart-core/Provisional-class.html
[`provisional`]: https://api.dart.dev/stable/2.18.4/dart-core/provisional-constant.html
[`proxy`]: https://api.dart.dev/stable/2.18.4/dart-core/proxy-constant.html
[`CastError`]: https://api.dart.dev/stable/2.18.3/dart-core/CastError-class.html
[`TypeError`]: https://api.dart.dev/stable/2.18.3/dart-core/TypeError-class.html
[`FallThroughError`]: https://api.dart.dev/dev/2.19.0-374.0.dev/dart-core/FallThroughError-class.html
[`AbstractClassInstantiationError`]: https://api.dart.dev/stable/2.18.3/dart-core/AbstractClassInstantiationError-class.html
#### `dart:html`

View file

@ -104,12 +104,10 @@ additionalExports = (core::Deprecated,
core::Error,
core::AssertionError,
core::TypeError,
core::CastError,
core::NullThrownError,
core::ArgumentError,
core::RangeError,
core::IndexError,
core::FallThroughError,
core::NoSuchMethodError,
core::UnsupportedError,
core::UnimplementedError,

View file

@ -39,12 +39,10 @@ additionalExports = (core::Deprecated,
core::Error,
core::AssertionError,
core::TypeError,
core::CastError,
core::NullThrownError,
core::ArgumentError,
core::RangeError,
core::IndexError,
core::FallThroughError,
core::NoSuchMethodError,
core::UnsupportedError,
core::UnimplementedError,

View file

@ -100,12 +100,10 @@ additionalExports = (core::Deprecated,
core::Error,
core::AssertionError,
core::TypeError,
core::CastError,
core::NullThrownError,
core::ArgumentError,
core::RangeError,
core::IndexError,
core::FallThroughError,
core::NoSuchMethodError,
core::UnsupportedError,
core::UnimplementedError,

View file

@ -13,7 +13,6 @@ additionalExports = (asy::Future,
core::AssertionError,
core::BidirectionalIterator,
core::BigInt,
core::CastError,
core::Comparable,
core::ConcurrentModificationError,
core::DateTime,
@ -26,7 +25,6 @@ additionalExports = (asy::Future,
core::Error,
core::Exception,
core::Expando,
core::FallThroughError,
core::Finalizer,
core::FormatException,
core::Function,

View file

@ -13,7 +13,6 @@ additionalExports = (asy::Future,
core::AssertionError,
core::BidirectionalIterator,
core::BigInt,
core::CastError,
core::Comparable,
core::ConcurrentModificationError,
core::DateTime,
@ -26,7 +25,6 @@ additionalExports = (asy::Future,
core::Error,
core::Exception,
core::Expando,
core::FallThroughError,
core::Finalizer,
core::FormatException,
core::Function,

View file

@ -357,15 +357,6 @@ class Error {
}
}
@patch
class FallThroughError {
@patch
FallThroughError._create(String url, int line);
@patch
String toString() => super.toString();
}
// Patch for DateTime implementation.
@patch
class DateTime {

View file

@ -587,12 +587,6 @@ jsPropertyAccess(jsObject, String property) {
return JS('var', r'#[#]', jsObject, property);
}
/**
* Called at the end of unaborted switch cases to get the singleton
* FallThroughError exception that will be thrown.
*/
getFallThroughError() => FallThroughErrorImplementation();
/**
* A metadata annotation describing the types instantiated by a native element.
*
@ -685,7 +679,7 @@ class JSName {
abstract class JavaScriptIndexingBehavior<E> extends JSMutableIndexable<E> {}
/// Thrown by type assertions that fail.
class TypeErrorImpl extends Error implements TypeError, CastError {
class TypeErrorImpl extends Error implements TypeError {
final String _message;
TypeErrorImpl(this._message);
@ -693,10 +687,6 @@ class TypeErrorImpl extends Error implements TypeError, CastError {
String toString() => _message;
}
class FallThroughErrorImplementation extends FallThroughError {
String toString() => "Switch case fall-through.";
}
/**
* Error thrown when a runtime error occurs.
*/

View file

@ -244,15 +244,6 @@ class Error {
}
}
@patch
class FallThroughError {
@patch
FallThroughError._create(String url, int line);
@patch
String toString() => super.toString();
}
// Patch for DateTime implementation.
@patch
class DateTime {

View file

@ -2570,11 +2570,6 @@ void checkDeferredIsLoaded(String loadId) {
/// visible to anyone, and is only injected into special libraries.
abstract class JavaScriptIndexingBehavior<E> extends JSMutableIndexable<E> {}
class FallThroughErrorImplementation extends FallThroughError {
FallThroughErrorImplementation();
String toString() => 'Switch case fall-through.';
}
/// Helper function for implementing asserts. The compiler treats this
/// specially.
///

View file

@ -1125,7 +1125,7 @@ class _Error extends Error {
String toString() => _message;
}
class _TypeError extends _Error implements TypeError, CastError {
class _TypeError extends _Error implements TypeError {
_TypeError.fromMessage(String message) : super('TypeError: $message');
factory _TypeError.forType(object, String type) {

View file

@ -95,7 +95,7 @@ class _AssertionError extends Error implements AssertionError {
final Object? message;
}
class _TypeError extends Error implements TypeError, CastError {
class _TypeError extends Error implements TypeError {
@pragma("vm:entry-point")
_TypeError._create(this._url, this._line, this._column, this._message);
@ -112,39 +112,6 @@ class _TypeError extends Error implements TypeError, CastError {
final String _message;
}
class _CastError extends Error implements CastError, TypeError {
@pragma("vm:entry-point")
_CastError._create(this._url, this._line, this._column, this._errorMsg);
// A CastError is allocated by TypeError._throwNew() when dstName equals
// Symbols::InTypeCast().
String toString() => _errorMsg;
// Fields _url, _line, and _column are only used for debugging purposes.
final String? _url;
final int? _line;
final int? _column;
final String _errorMsg;
}
@patch
class FallThroughError {
@patch
@pragma("vm:entry-point")
FallThroughError._create(this._url, this._line);
@patch
String toString() {
return "'$_url': Switch case fall-through at line $_line.";
}
// These new fields cannot be declared final, because a constructor exists
// in the original version of this patched class.
String? _url;
int _line = 0;
}
class _InternalError {
@pragma("vm:entry-point")
const _InternalError(this._msg);

View file

@ -142,10 +142,6 @@ class AssertionError extends Error {
/// Error thrown by the runtime system when a dynamic type error happens.
class TypeError extends Error {}
/// Error thrown by the runtime system when a cast operation fails.
@Deprecated("Use TypeError instead")
class CastError extends Error {}
/// Error thrown when attempting to throw `null`.
///
/// In null safe code, you are statically disallowed from throwing `null`,
@ -515,31 +511,14 @@ class IndexError extends ArgumentError implements RangeError {
}
}
/// Error previously thrown when control reaches the end of a switch case.
/// Error thrown on an invalid function or method invocation.
///
/// The pre-2.0 Dart specification required this error to be thrown when
/// control reached the end of a switch case (except the last case
/// of a switch) without meeting a `break` or other control flow operators.
/// That kind of fall-through was made a compile-time error Dart 2.0,
/// so this error is no longer thrown.
@Deprecated("No longer relevant in Dart 2.0")
class FallThroughError extends Error {
FallThroughError();
@pragma("vm:entry-point")
external FallThroughError._create(String url, int line);
external String toString();
}
/// Error thrown when a particular method invocation is not possible.
/// Thrown when a dynamic function or method call provides an invalid
/// type argument or argument list to the function being called.
/// For non-dynamic invocations, static type checking prevents
/// such invalid arguments.
///
/// This error is thrown by the default implementation of `noSuchMethod`
/// on [Object], which is the default behavior of a failed dynamic
/// invocation.
///
/// The error is also thrown in other cases where an object
/// does not support a requested operation, but where the failed operation
/// does not trigger a call to [Object.noSuchMethod].
/// Also thrown by the default implementation of [Object.noSuchMethod].
class NoSuchMethodError extends Error {
/// Creates a [NoSuchMethodError] corresponding to a failed method call.
///