blob: a0d946f7ca7ebf3345d25e74f0dae6f8d3a00c42 [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.
// @dart=3.2
// This test exercises a soundness bug in language version <= 3.2.
import 'package:expect/expect.dart';
sealed class S {
bool get b;
}
class A implements S {
final bool b;
A(this.b);
}
class B implements S {
final bool b;
B(this.b);
}
class C implements A, B {
bool get b => false;
}
int? value = 1;
int? method(S s) => switch (s) {
A(b: true) as A => 0,
B(b: true) as B => value,
};
main() {
Expect.throws(() => method(C()));
}