blob: e45259599cc81261dcb356a09c793c3d81ad53b2 [file] [log] [blame]
// 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.
/// Regression test for https://github.com/dart-lang/sdk/issues/52409.
import 'package:expect/expect.dart';
import "../static_type_helper.dart";
class A {
Never get getterThatReturnsNever => throw 0;
}
void f(Object? x) {
int? y = 0; // implicitly promotes to `int`
switch (x) {
case A(getterThatReturnsNever: _):
y = null;
default:
}
// `y = null` was unreachable, so `y` should still be promoted to `int`
y.expectStaticType<Exactly<int>>();
}
void main() {
f(0);
}