dart-sdk/tests/web_2/35965a_test.dart
Sigmund Cherem 912005267d [web] rename suite dart2js -> web.
Change-Id: I46be49b2effec3e38a3dc44cd45cfe736f77fa78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182680
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-02-04 23:11:32 +00:00

65 lines
1.7 KiB
Dart

// Copyright (c) 2019, 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 = 2.7
// Regression test for issue 35965.
//
// The combination of generator bodies on mixin methods with super-calls caused
// various kinds of broken generated JavaScript.
//
// - The generator body name had unescaped '&' symbols from the Kernel
// synthesized super-mixin-application class.
// - The super-mixin-application class was missing the generator body because
// it did not expect injected members.
import 'dart:async';
abstract class II {
bar();
}
mixin M on II {
// The parameter type check causes the generator to have a body.
//
// The super call causes the body to be on the super mixin application.
//
// The super call causes the body to have a name depending on the super mixin
// application name.
Future<T> foo<T>(T a) async {
super.bar();
return a;
}
// The parameter type check causes the generator to have a body.
//
// The super call causes 'fred' to be on the super mixin application.
//
// The super call causes the closure's call method's generator to have a name
// depending on the super mixin application name.
fred<T>() => (T a) async {
super.bar();
return a;
};
}
class BB implements II {
bar() {
print('BB.bar');
}
}
class UU extends BB with M {}
main() async {
print('hello');
var uu = UU();
print(await uu.foo<int>(1));
print(await uu.foo<String>("one"));
print(await uu.fred<int>()(1));
print(await uu.fred<String>()("uno"));
}