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

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_test.dart

Issue 2109353004: Revert "fix #25794, infer parameter type from default value" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.src.serialization.elements_test; 5 library test.src.serialization.elements_test;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/constant/value.dart'; 10 import 'package:analyzer/dart/constant/value.dart';
(...skipping 4089 matching lines...) Expand 10 before | Expand all | Expand 10 after
4100 } 4100 }
4101 4101
4102 test_operator_index_set() { 4102 test_operator_index_set() {
4103 checkLibrary('class C { void operator[]=(int i, bool v) {} }'); 4103 checkLibrary('class C { void operator[]=(int i, bool v) {} }');
4104 } 4104 }
4105 4105
4106 test_operator_less_equal() { 4106 test_operator_less_equal() {
4107 checkLibrary('class C { bool operator<=(C other) => false; }'); 4107 checkLibrary('class C { bool operator<=(C other) => false; }');
4108 } 4108 }
4109 4109
4110 test_parameterType_inferred_constructor() { 4110 test_parameterTypeNotInferred_constructor() {
4111 // Strong mode doesn't do type inference on constructor parameters, so it's
4112 // ok that we don't store inferred type info for them in summaries.
4111 checkLibrary(''' 4113 checkLibrary('''
4112 class C { 4114 class C {
4113 C.positional([x = 1]); 4115 C.positional([x = 1]);
4114 C.named({x: 1}); 4116 C.named({x: 1});
4115 } 4117 }
4116 '''); 4118 ''');
4117 } 4119 }
4118 4120
4119 test_parameterType_inferred_staticMethod() {
4120 checkLibrary('''
4121 class C {
4122 static void positional([x = 1]) {}
4123 static void named({x: 1}) {}
4124 }
4125 ''');
4126 }
4127
4128 test_parameterType_inferred_topLevelFunction() {
4129 checkLibrary('''
4130 void positional([x = 1]) {}
4131 void named({x: 1}) {}
4132 ''');
4133 }
4134
4135 test_parameterTypeNotInferred_initializingFormal() { 4121 test_parameterTypeNotInferred_initializingFormal() {
4136 // Strong mode doesn't do type inference on initializing formals, so it's 4122 // Strong mode doesn't do type inference on initializing formals, so it's
4137 // ok that we don't store inferred type info for them in summaries. 4123 // ok that we don't store inferred type info for them in summaries.
4138 checkLibrary(''' 4124 checkLibrary('''
4139 class C { 4125 class C {
4140 var x; 4126 var x;
4141 C.positional([this.x = 1]); 4127 C.positional([this.x = 1]);
4142 C.named({this.x: 1}); 4128 C.named({this.x: 1});
4143 } 4129 }
4144 '''); 4130 ''');
4145 } 4131 }
4146 4132
4133 test_parameterTypeNotInferred_staticMethod() {
4134 // Strong mode doesn't do type inference on parameters of static methods,
4135 // so it's ok that we don't store inferred type info for them in summaries.
4136 checkLibrary('''
4137 class C {
4138 static void positional([x = 1]) {}
4139 static void named({x: 1}) {}
4140 }
4141 ''');
4142 }
4143
4144 test_parameterTypeNotInferred_topLevelFunction() {
4145 // Strong mode doesn't do type inference on parameters of top level
4146 // functions, so it's ok that we don't store inferred type info for them in
4147 // summaries.
4148 checkLibrary('''
4149 void positional([x = 1]) {}
4150 void named({x: 1}) {}
4151 ''');
4152 }
4153
4147 test_parts() { 4154 test_parts() {
4148 addSource('/a.dart', 'part of my.lib;'); 4155 addSource('/a.dart', 'part of my.lib;');
4149 addSource('/b.dart', 'part of my.lib;'); 4156 addSource('/b.dart', 'part of my.lib;');
4150 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); 4157 checkLibrary('library my.lib; part "a.dart"; part "b.dart";');
4151 } 4158 }
4152 4159
4153 test_propagated_type_refers_to_closure() { 4160 test_propagated_type_refers_to_closure() {
4154 checkLibrary(''' 4161 checkLibrary('''
4155 void f() { 4162 void f() {
4156 var x = () => 0; 4163 var x = () => 0;
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
4612 fail('Unexpectedly tried to get unlinked summary for $uri'); 4619 fail('Unexpectedly tried to get unlinked summary for $uri');
4613 } 4620 }
4614 return serializedUnit; 4621 return serializedUnit;
4615 } 4622 }
4616 4623
4617 @override 4624 @override
4618 bool hasLibrarySummary(String uri) { 4625 bool hasLibrarySummary(String uri) {
4619 return true; 4626 return true;
4620 } 4627 }
4621 } 4628 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_ast_test.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698