c4724e5a89
This adds a `forErrorHandling` to the `Throw` node. This is used that the `throw` is *not* present in the source code but added to ensure correctness and/or soundness of the generated code. This is used for instance in the lowering for handling duplicate writes to a late final field or for pattern assignments that don't match. In response to https://github.com/dart-lang/sdk/issues/53519 TEST=updated ast-to-text Change-Id: Ie103829d98fda9cd7b64e9e3d893e77d1e86d7d8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347900 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com> Reviewed-by: Liam Appelbe <liama@google.com>
23 lines
862 B
Plaintext
23 lines
862 B
Plaintext
library;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/patterns/switchExpression_empty.dart:5:16: Error: The type 'dynamic' is not exhaustively matched by the switch cases since it doesn't match 'Object()'.
|
|
// Try adding a wildcard pattern or cases that match 'Object()'.
|
|
// f(x) => switch(x) {};
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:_internal" as _in;
|
|
|
|
static method f(dynamic x) → dynamic
|
|
return let final Never #t1 = block {
|
|
Never #t2;
|
|
#L1:
|
|
switch(x) /* isExplicitlyExhaustive, dynamic */ {
|
|
#L2:
|
|
default:
|
|
throw{for-error-handling} new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
|
}
|
|
} =>#t2 in throw{for-error-handling} new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
|