Files
sdk/pkg/_fe_analyzer_shared/test/exhaustiveness/data/empty.dart
T
Paul Berry 0fcd1a6fa1 Bump _fe_analyzer_shared to SDK 3.7 and reformat
Change-Id: I70157caf90c0955c2eb8426f5721ba4ed527eb76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427900
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-10 15:32:50 -07:00

60 lines
1.3 KiB
Dart

// Copyright (c) 2023, 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.
emptyBool(bool b) {
return /*
checkingOrder={bool,true,false},
error=non-exhaustive:true;false,
subtypes={true,false},
type=bool
*/ switch (b) {};
}
emptyNum(num n) {
return /*
checkingOrder={num,double,int},
error=non-exhaustive:double();int(),
subtypes={double,int},
type=num
*/ switch (n) {};
}
emptyInt(int i) {
return /*
error=non-exhaustive:int(),
type=int
*/ switch (i) {};
}
enum E { a, b }
emptyEnum(E e) {
return /*
checkingOrder={E,E.a,E.b},
error=non-exhaustive:E.a;E.b,
subtypes={E.a,E.b},
type=E
*/ switch (e) {};
}
sealed class Empty {}
emptySealed(Empty empty) => /*
checkingOrder={Empty},
type=Empty
*/
switch (empty) {};
emptyNever(Never never) => /*type=Never*/ switch (never) {};
emptyUnresolved(
Unresolved unresolved,
) => /*cfe.type=Never*/ /*analyzer.type=InvalidType*/ switch (unresolved) {};
nonEmptyUnresolved(
Unresolved unresolved,
) => /*cfe.type=Never*/ /*analyzer.type=InvalidType*/ switch (unresolved) {
_ /*cfe.space=∅*/ /*analyzer.space=InvalidType*/ => 0,
};