Skip to content

Commit

Permalink
Version 3.3.0-120.0.dev
Browse files Browse the repository at this point in the history
Merge 69cf1df into dev
  • Loading branch information
Dart CI committed Nov 10, 2023
2 parents 91c4a92 + 69cf1df commit 370145b
Show file tree
Hide file tree
Showing 8 changed files with 1,236 additions and 153 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ vars = {

# co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
# hashes.
"co19_rev": "cee2c7fe253fa70df29f28e7610a824800a477c5",
"co19_rev": "306f82e85b3d9e596eed38d36cbef369643515c0",
# This line prevents conflicts when both packages are rolled simultaneously.
"co19_2_rev": "d87f9096ec0a14cd7c32c33316fb2378b89d6a45",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) 2023, 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.

import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../fix_processor.dart';
import 'data_driven_test_support.dart';

void main() {
defineReflectiveSuite(() {
defineReflectiveTests(PlatformUseCaseTest);
});
}

@reflectiveTest
class PlatformUseCaseTest extends DataDrivenFixProcessorTest {
Future<void> test_platform_LocalPlatform_isAndroid_deprecated() async {
newFile('$workspaceRootPath/p/lib/lib.dart', '''
class LocalPlatform {
@deprecated
bool get isAndroid => true;
}
''');
newFile('$workspaceRootPath/p/lib/host.dart', '''
class HostPlatform {
static HostPlatform get current => HostPlatform();
bool get isAndroid => true;
}
''');

writeTestPackageConfig(
config: PackageConfigFileBuilder()
..add(name: 'p', rootPath: '$workspaceRootPath/p'),
);

addPackageDataFile('''
version: 1
transforms:
- title: 'Replace by HostPlatform'
date: 2023-11-09
element:
uris: [ '$importUri' ]
getter: 'isAndroid'
inClass: LocalPlatform
changes:
- kind: 'replacedBy'
replaceTarget: true
newElement:
uris: [ 'package:p/host.dart' ]
getter: current.isAndroid
inClass: HostPlatform
static: true
''');

await resolveTestCode('''
import '$importUri';
main() {
var isAndroid = LocalPlatform().isAndroid;
print(isAndroid);
}
''');
await assertHasFix('''
import 'package:p/host.dart';
import '$importUri';
main() {
var isAndroid = HostPlatform.current.isAndroid;
print(isAndroid);
}
''');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'element_matcher_test.dart' as element_matcher;
import 'end_to_end_test.dart' as end_to_end;
import 'flutter_use_case_test.dart' as flutter_use_case;
import 'modify_parameters_test.dart' as modify_parameters;
import 'platform_use_case_test.dart' as platform_use_case;
import 'rename_parameter_test.dart' as rename_parameter;
import 'rename_test.dart' as rename;
import 'replaced_by_test.dart' as replaced_by;
Expand All @@ -34,6 +35,7 @@ void main() {
end_to_end.main();
flutter_use_case.main();
modify_parameters.main();
platform_use_case.main();
rename_parameter.main();
rename.main();
replaced_by.main();
Expand Down
4 changes: 0 additions & 4 deletions pkg/analyzer/lib/src/generated/source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ class NonExistingSource extends Source {
abstract class Source {
/// Get the contents and timestamp of this source.
///
/// Clients should consider using the method [AnalysisContext.getContents]
/// because contexts can have local overrides of the content of a source that
/// the source is not aware of.
///
/// @return the contents and timestamp of the source
/// @throws Exception if the contents of this source could not be accessed
TimestampedData<String> get contents;
Expand Down
Loading

0 comments on commit 370145b

Please sign in to comment.