Files
sdk/pkg/front_end/testcases/nnbd/issue43591.dart
T
Johnni Winther 5efe55abf7 [cfe] Fix missing case of using receiver type instead of bound
+ fix test to expect erasure of `S & int` to `S` also when bound is `dynamic`.

Closes #43591

Change-Id: I44cb4c726648d4065bdf89bb2dbf71b2753c6c84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169340
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-10-30 16:33:51 +00:00

27 lines
502 B
Dart

// Copyright (c) 2020, 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.
extension E<T> on T {
T Function(T) get f => (T t) => t;
}
method1<S>(S s) {
S Function(S) f = s.f;
}
method2<S extends dynamic>(S s) {
throws(() => s.f);
}
main() {}
throws(void Function() f) {
try {
f();
} catch (e) {
return;
}
throw 'Expected exception';
}