blob: e4b4947b6cf16a1b716801427f589bd6ee64babc [file] [log] [blame]
// Copyright (c) 2021, 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.
// SharedOptions=--enable-experiment=nonfunction-type-aliases
// Test that private names exported via public typedefs can be used in a try
// catch.
import "package:expect/expect.dart";
import "private_name_library.dart";
class Derived extends PublicClass {}
void test1() {
try {
throw Derived();
} on PublicClass catch (e) {}
try {
throw Derived();
} on Derived catch (e) {}
try {
throw PublicClass();
} on PublicClass catch (e) {}
try {
throw PublicClass();
} on AlsoPublicClass catch (e) {}
Expect.throws(() {
try {
throw PublicClass();
} on Derived catch (e) {}
});
}
void main() {
test1();
}