Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(948)

Unified Diff: pkg/analyzer/test/src/task/strong/checker_test.dart

Issue 1893053002: Handle fuzzy optional parameters correctly. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/checker_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index cff878253e8a335a4850fdd2bbcebb6b14bde2e4..6ddbcafc7c03a3f7a56aea9e2d4165d8eaa42d3c 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -737,7 +737,47 @@ void main() {
test('dynamic functions - closures are not fuzzy', () {
// Regression test for
// https://github.com/dart-lang/sdk/issues/26118
+ // https://github.com/dart-lang/sdk/issues/26156
checkFile('''
+ void takesF(void f(int x)) {}
+
+ typedef void TakesInt(int x);
+
+ void update(_) {}
+ void updateOpt([_]) {}
+ void updateOptNum([num x]) {}
+
+ class A {
+ TakesInt f;
+ A(TakesInt g) {
+ f = update;
+ f = updateOpt;
+ f = updateOptNum;
+ }
+ TakesInt g(bool a, bool b) {
+ if (a) {
+ return update;
+ } else if (b) {
+ return updateOpt;
+ } else {
+ return updateOptNum;
+ }
+ }
+ }
+
+ void test0() {
+ takesF(update);
+ takesF(updateOpt);
+ takesF(updateOptNum);
+ TakesInt f;
+ f = update;
+ f = updateOpt;
+ f = updateOptNum;
+ new A(update);
+ new A(updateOpt);
+ new A(updateOptNum);
+ }
+
void test1() {
void takesF(f(int x)) => null;
takesF((dynamic y) => 3);
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698