Files
sdk/tests/web/local_function_signatures_strong_test.dart
Robert Nystrom d7ed15658a Opt multitests out of formatting in web/.
The new formatter supports opting a region of code out from being
formatted. I'm applying this marker to all of the multitests since
those tests are often very sensitive to formatting and easily broken.
This way, anyone touching a multitest (including me when I reformat
the tests) doesn't have to remember to not run the formatter on it.

Change-Id: I3d6346d31581772dc8e1701594bf9d919f28db7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396104
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2024-11-19 00:59:10 +00:00

116 lines
2.4 KiB
Dart

// Copyright (c) 2018, 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.
// Formatting can break multitests, so don't format them.
// dart format off
import 'package:expect/expect.dart';
class Class1 {
method1() {
num local<T>(num n) => null as dynamic;
return local;
}
method2() {
num local<T>(int n) => null as dynamic;
return local;
}
method3() {
int local<T>(num n) => null as dynamic;
return local;
}
}
class Class2 {
method4<T>() {
num local(T n) => null as dynamic;
return local;
}
}
class Class3 {
method5<T>() {
T local(num n) => null as dynamic;
return local;
}
}
class Class4 {
method6<T>() {
num local(num n, T t) => null as dynamic;
return local;
}
}
method7<T>() {
num local(T n) => null as dynamic;
return local;
}
method8<T>() {
T local(num n) => null as dynamic;
return local;
}
method9<T>() {
num local(num n, T t) => null as dynamic;
return local;
}
method10() {
num local<T>(T n) => null as dynamic;
return local;
}
method11() {
T local<T>(num n) => null as dynamic;
return local;
}
method12() {
num local<T>(num n, T t) => null as dynamic;
return local;
}
num Function(num) //# 01: ok
method13() {
num local<T>(num n) => null as dynamic;
return local;
}
num Function(num) //# 01: continued
method14() {
num local<T>(T n) => null as dynamic;
return local;
}
num Function(num) //# 01: continued
method15() {
T local<T>(num n) => null as dynamic;
return local;
}
@pragma('dart2js:noInline')
test(o) => o is num Function(num);
main() {
Expect.isFalse(test(new Class1().method1()));
Expect.isFalse(test(new Class1().method2()));
Expect.isFalse(test(new Class1().method3()));
Expect.isTrue(test(new Class2().method4<num>()));
Expect.isTrue(test(new Class3().method5<num>()));
Expect.isFalse(test(new Class4().method6<num>()));
Expect.isTrue(test(method7<num>()));
Expect.isTrue(test(method8<num>()));
Expect.isFalse(test(method9()));
Expect.isFalse(test(method10()));
Expect.isFalse(test(method11()));
Expect.isFalse(test(method12()));
Expect.isTrue(test(method13())); //# 01: continued
Expect.isTrue(test(method14())); //# 01: continued
Expect.isTrue(test(method15())); //# 01: continued
}