Migration: opt in dependencies in migration unit tests

Early in the development of the migration tool, due to language
versioning support being incomplete, it didn't have a good way to
distinguish opted in from opted out code, so we had the convention
that any code not being migrated was opted in.  Now that we have
language versioning support, we need to explicitly opt that code in.

Without this change, we'll get bogus failures when we add logic to
detect unmigrated dependencies.

Bug: https://github.com/dart-lang/sdk/issues/44061
Change-Id: I12920ea75b8af2142a044314b89b76bb602897c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170560
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
Paul Berry 2020-11-05 18:16:57 +00:00 committed by commit-bot@chromium.org
parent 9e6486fe3f
commit e8c8e51139
2 changed files with 14 additions and 5 deletions

View file

@ -165,7 +165,7 @@ environment:
'name': packageName,
'rootUri': toUriStr('/.pub-cache/$packageName'),
'packageUri': 'lib/',
'languageVersion': '2.9'
'languageVersion': '2.12'
},
{
'name': 'tests',

View file

@ -394,6 +394,7 @@ void f() {
}
''';
var alreadyMigrated = '''
// @dart=2.12
extension Ext<T> on List<T> {
g() {}
}
@ -6600,7 +6601,10 @@ void main(F<int?> f) {
}
''';
await _checkSingleFileChanges(content, expected, migratedInput: {
'$projectPath/lib/migrated_typedef.dart': 'typedef F<R> = Function(R);'
'$projectPath/lib/migrated_typedef.dart': '''
// @dart=2.12
typedef F<R> = Function(R);
'''
});
}
@ -6636,8 +6640,10 @@ void f4(F<int> f) {
}
''';
await _checkSingleFileChanges(content, expected, migratedInput: {
'$projectPath/lib/migrated_typedef.dart':
'typedef F<T> = Function<R>(T, R);'
'$projectPath/lib/migrated_typedef.dart': '''
// @dart=2.12
typedef F<T> = Function<R>(T, R);
'''
});
}
@ -6655,7 +6661,10 @@ void main(F f) {
}
''';
await _checkSingleFileChanges(content, expected, migratedInput: {
'$projectPath/lib/migrated_typedef.dart': 'typedef F = Function<R>(R);'
'$projectPath/lib/migrated_typedef.dart': '''
// @dart=2.12
typedef F = Function<R>(R);
'''
});
}