mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:20:31 +00:00
Legacy. Remove tests for language versions 2.6, 2.7, 2.8
Change-Id: I5dadd2c9a6720125f3bf0cdeaeaa2d8bda411534 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349922 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
parent
28c7f5bd1e
commit
f3486f7e3e
5 changed files with 3 additions and 392 deletions
|
@ -205,7 +205,7 @@ int? f() => 1;
|
|||
|
||||
test_parseString_languageVersion() {
|
||||
var content = '''
|
||||
// @dart = 2.7
|
||||
// @dart = 3.2
|
||||
class A {}
|
||||
''';
|
||||
var result = parseString(
|
||||
|
@ -215,8 +215,8 @@ class A {}
|
|||
);
|
||||
|
||||
var languageVersion = result.unit.languageVersionToken!;
|
||||
expect(languageVersion.major, 2);
|
||||
expect(languageVersion.minor, 7);
|
||||
expect(languageVersion.major, 3);
|
||||
expect(languageVersion.minor, 2);
|
||||
}
|
||||
|
||||
test_parseString_languageVersion_null() {
|
||||
|
|
|
@ -1445,35 +1445,6 @@ self::@function::bar
|
|||
''');
|
||||
}
|
||||
|
||||
test_searchReferences_ImportElement_noPrefix_optIn_fromOptOut() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
class N1 {}
|
||||
void N2() {}
|
||||
int get N3 => 0;
|
||||
set N4(int _) {}
|
||||
''');
|
||||
|
||||
await resolveTestCode('''
|
||||
// @dart = 2.7
|
||||
import 'a.dart';
|
||||
|
||||
main() {
|
||||
N1;
|
||||
N2();
|
||||
N3;
|
||||
N4 = 0;
|
||||
}
|
||||
''');
|
||||
final element = findElement.import('package:test/a.dart');
|
||||
await assertElementReferencesText(element, r'''
|
||||
self::@function::main
|
||||
44 5:3 || REFERENCE
|
||||
50 6:3 || REFERENCE
|
||||
58 7:3 || REFERENCE
|
||||
64 8:3 || REFERENCE
|
||||
''');
|
||||
}
|
||||
|
||||
test_searchReferences_ImportElement_withPrefix() async {
|
||||
await resolveTestCode('''
|
||||
import 'dart:math' as math show max, pi, Random hide min;
|
||||
|
@ -1521,35 +1492,6 @@ self::@function::main
|
|||
}
|
||||
}
|
||||
|
||||
test_searchReferences_ImportElement_withPrefix_optIn_fromOptOut() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
class N1 {}
|
||||
void N2() {}
|
||||
int get N3 => 0;
|
||||
set N4(int _) {}
|
||||
''');
|
||||
|
||||
await resolveTestCode('''
|
||||
// @dart = 2.7
|
||||
import 'a.dart' as a;
|
||||
|
||||
main() {
|
||||
a.N1;
|
||||
a.N2();
|
||||
a.N3;
|
||||
a.N4 = 0;
|
||||
}
|
||||
''');
|
||||
final element = findElement.import('package:test/a.dart');
|
||||
await assertElementReferencesText(element, r'''
|
||||
self::@function::main
|
||||
49 5:3 |a.| REFERENCE
|
||||
57 6:3 |a.| REFERENCE
|
||||
67 7:3 |a.| REFERENCE
|
||||
75 8:3 |a.| REFERENCE
|
||||
''');
|
||||
}
|
||||
|
||||
test_searchReferences_LabelElement() async {
|
||||
await resolveTestCode('''
|
||||
main() {
|
||||
|
|
|
@ -406,7 +406,6 @@ A.foo: void Function()
|
|||
|
||||
test_getInheritedMap_topMerge_method() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.6
|
||||
class A {
|
||||
void foo({int a}) {}
|
||||
}
|
||||
|
@ -425,7 +424,6 @@ class C implements A, B {
|
|||
''');
|
||||
|
||||
_assertInheritedMap('C', r'''
|
||||
A.foo: void Function({int a})
|
||||
''');
|
||||
}
|
||||
|
||||
|
@ -1065,31 +1063,6 @@ class B extends A {
|
|||
);
|
||||
}
|
||||
|
||||
test_getMember_optIn_inheritsOptOut() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.6
|
||||
class A {
|
||||
int foo(int a, int b) => 0;
|
||||
}
|
||||
''');
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
class B extends A {
|
||||
int? bar(int a) => 0;
|
||||
}
|
||||
''');
|
||||
_assertGetMember(
|
||||
className: 'B',
|
||||
name: 'foo',
|
||||
expected: 'A.foo: int* Function(int*, int*)*',
|
||||
);
|
||||
_assertGetMember(
|
||||
className: 'B',
|
||||
name: 'bar',
|
||||
expected: 'B.bar: int? Function(int)',
|
||||
);
|
||||
}
|
||||
|
||||
test_getMember_optIn_topMerge_getter_existing() async {
|
||||
await resolveTestCode('''
|
||||
class A {
|
||||
|
|
|
@ -158,28 +158,6 @@ class X implements A, B, C {
|
|||
_assertFieldTypeDynamic(foo);
|
||||
}
|
||||
|
||||
test_field_multiple_gettersSetters_final_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
abstract class A {
|
||||
int get foo;
|
||||
}
|
||||
abstract class B {
|
||||
set foo(num _);
|
||||
}
|
||||
''');
|
||||
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
class X implements A, B {
|
||||
final foo;
|
||||
}
|
||||
''');
|
||||
var foo = findElement.field('foo', of: 'X');
|
||||
_assertFieldType(foo, 'int');
|
||||
}
|
||||
|
||||
test_field_multiple_gettersSetters_notFinal_combined_notSame() async {
|
||||
await resolveTestCode('''
|
||||
class A {
|
||||
|
@ -257,28 +235,6 @@ class X implements A, B, C {
|
|||
_assertFieldTypeDynamic(foo);
|
||||
}
|
||||
|
||||
test_field_multiple_gettersSetters_notFinal_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
abstract class A {
|
||||
int get foo;
|
||||
}
|
||||
abstract class B {
|
||||
set foo(int _);
|
||||
}
|
||||
''');
|
||||
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
class X implements A, B {
|
||||
var foo;
|
||||
}
|
||||
''');
|
||||
var foo = findElement.field('foo', of: 'X');
|
||||
_assertFieldType(foo, 'int');
|
||||
}
|
||||
|
||||
test_field_multiple_setters_combined() async {
|
||||
await resolveTestCode('''
|
||||
class A {
|
||||
|
@ -311,42 +267,6 @@ class C implements A, B {
|
|||
_assertFieldTypeDynamic(foo);
|
||||
}
|
||||
|
||||
test_field_single_getter_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
abstract class A {
|
||||
int get foo;
|
||||
}
|
||||
''');
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
abstract class B implements A {
|
||||
var foo;
|
||||
}
|
||||
''');
|
||||
var foo = findElement.field('foo', of: 'B');
|
||||
_assertFieldType(foo, 'int');
|
||||
}
|
||||
|
||||
test_field_single_setter_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
abstract class A {
|
||||
set foo(int _);
|
||||
}
|
||||
''');
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
abstract class B implements A {
|
||||
var foo;
|
||||
}
|
||||
''');
|
||||
var foo = findElement.field('foo', of: 'B');
|
||||
_assertFieldType(foo, 'int');
|
||||
}
|
||||
|
||||
test_getter_multiple_getters_combined() async {
|
||||
await resolveTestCode('''
|
||||
class A {
|
||||
|
@ -465,42 +385,6 @@ class C implements A, B {
|
|||
_assertGetterTypeDynamic(foo);
|
||||
}
|
||||
|
||||
test_getter_single_getter_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
abstract class A {
|
||||
int get foo;
|
||||
}
|
||||
''');
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
abstract class B implements A {
|
||||
get foo;
|
||||
}
|
||||
''');
|
||||
var foo = findElement.getter('foo', of: 'B');
|
||||
_assertGetterType(foo, 'int');
|
||||
}
|
||||
|
||||
test_getter_single_setter_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
abstract class A {
|
||||
set foo(int _);
|
||||
}
|
||||
''');
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
abstract class B implements A {
|
||||
get foo;
|
||||
}
|
||||
''');
|
||||
var foo = findElement.getter('foo', of: 'B');
|
||||
_assertGetterType(foo, 'int');
|
||||
}
|
||||
|
||||
test_invalid_field_overrides_method() async {
|
||||
await resolveTestCode('''
|
||||
abstract class A {
|
||||
|
@ -714,24 +598,6 @@ class C<T> implements A<T> {
|
|||
assertType(p.type, 'T');
|
||||
}
|
||||
|
||||
test_method_parameter_required_single_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
class A {
|
||||
void foo(int p) {}
|
||||
}
|
||||
''');
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
class B implements A {
|
||||
void foo(p) {}
|
||||
}
|
||||
''');
|
||||
var p = findElement.method('foo', of: 'B').parameters[0];
|
||||
assertType(p.type, 'int');
|
||||
}
|
||||
|
||||
test_method_parameter_requiredAndPositional() async {
|
||||
await resolveTestCode('''
|
||||
class A {
|
||||
|
@ -894,24 +760,6 @@ class C implements A, B {
|
|||
assertType(foo.returnType, 'void');
|
||||
}
|
||||
|
||||
test_method_return_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
abstract class A {
|
||||
int foo();
|
||||
}
|
||||
''');
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
abstract class B implements A {
|
||||
foo();
|
||||
}
|
||||
''');
|
||||
var foo = findElement.method('foo', of: 'B');
|
||||
assertType(foo.returnType, 'int');
|
||||
}
|
||||
|
||||
test_method_return_single() async {
|
||||
await resolveTestCode('''
|
||||
class A {
|
||||
|
@ -1056,42 +904,6 @@ class C implements A, B {
|
|||
_assertSetterTypeDynamic(foo);
|
||||
}
|
||||
|
||||
test_setter_single_getter_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
abstract class A {
|
||||
int get foo;
|
||||
}
|
||||
''');
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
abstract class B implements A {
|
||||
set foo(_);
|
||||
}
|
||||
''');
|
||||
var foo = findElement.setter('foo', of: 'B');
|
||||
_assertSetterType(foo, 'int');
|
||||
}
|
||||
|
||||
test_setter_single_setter_nonNullify() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.7
|
||||
abstract class A {
|
||||
set foo(int _);
|
||||
}
|
||||
''');
|
||||
await resolveTestCode('''
|
||||
import 'a.dart';
|
||||
|
||||
abstract class B implements A {
|
||||
set foo(_);
|
||||
}
|
||||
''');
|
||||
var foo = findElement.setter('foo', of: 'B');
|
||||
_assertSetterType(foo, 'int');
|
||||
}
|
||||
|
||||
test_setter_single_setter_withoutParameter() async {
|
||||
await resolveTestCode('''
|
||||
class A {
|
||||
|
|
|
@ -9638,43 +9638,6 @@ library
|
|||
''');
|
||||
}
|
||||
|
||||
test_class_field_type_inferred_nonNullify() async {
|
||||
addSource('$testPackageLibPath/a.dart', '''
|
||||
// @dart = 2.7
|
||||
var a = 0;
|
||||
''');
|
||||
|
||||
var library = await buildLibrary(r'''
|
||||
import 'a.dart';
|
||||
class C {
|
||||
var b = a;
|
||||
}
|
||||
''');
|
||||
|
||||
checkElementText(library, r'''
|
||||
library
|
||||
imports
|
||||
package:test/a.dart
|
||||
definingUnit
|
||||
classes
|
||||
class C @23
|
||||
fields
|
||||
b @33
|
||||
type: int
|
||||
shouldUseTypeForInitializerInference: false
|
||||
constructors
|
||||
synthetic @-1
|
||||
accessors
|
||||
synthetic get b @-1
|
||||
returnType: int
|
||||
synthetic set b= @-1
|
||||
parameters
|
||||
requiredPositional _b @-1
|
||||
type: int
|
||||
returnType: void
|
||||
''');
|
||||
}
|
||||
|
||||
test_class_field_typed() async {
|
||||
var library = await buildLibrary('class C { int x = 0; }');
|
||||
checkElementText(library, r'''
|
||||
|
@ -39676,54 +39639,6 @@ library
|
|||
''');
|
||||
}
|
||||
|
||||
test_mixin_inference_nullSafety_mixed_inOrder() async {
|
||||
addSource('$testPackageLibPath/a.dart', r'''
|
||||
class A<T> {}
|
||||
mixin M<U> on A<U> {}
|
||||
''');
|
||||
var library = await buildLibrary(r'''
|
||||
// @dart = 2.8
|
||||
import 'a.dart';
|
||||
class B extends A<int> with M {}
|
||||
''');
|
||||
checkElementText(library, r'''
|
||||
library
|
||||
imports
|
||||
package:test/a.dart
|
||||
definingUnit
|
||||
classes
|
||||
class B @38
|
||||
supertype: A<int*>*
|
||||
mixins
|
||||
M<int*>*
|
||||
constructors
|
||||
synthetic @-1
|
||||
superConstructor: ConstructorMember
|
||||
base: package:test/a.dart::@class::A::@constructor::new
|
||||
substitution: {T: int*}
|
||||
''');
|
||||
}
|
||||
|
||||
@SkippedTest(reason: 'Out-of-order inference is not specified yet')
|
||||
test_mixin_inference_nullSafety_mixed_outOfOrder() async {
|
||||
addSource('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.8
|
||||
class A<T> {}
|
||||
mixin M<U> on A<U> {}
|
||||
''');
|
||||
var library = await buildLibrary(r'''
|
||||
import 'a.dart';
|
||||
|
||||
class B extends A<int> with M {}
|
||||
''');
|
||||
checkElementText(library, r'''
|
||||
import 'a.dart';
|
||||
class B extends A<int> with M<int> {
|
||||
synthetic B();
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
test_mixin_inference_twoMixins() async {
|
||||
// Both `M1` and `M2` have their type arguments inferred.
|
||||
var library = await buildLibrary(r'''
|
||||
|
@ -48626,37 +48541,6 @@ library
|
|||
''');
|
||||
}
|
||||
|
||||
test_variable_type_inferred_nonNullify() async {
|
||||
addSource('$testPackageLibPath/a.dart', '''
|
||||
// @dart = 2.7
|
||||
var a = 0;
|
||||
''');
|
||||
|
||||
var library = await buildLibrary(r'''
|
||||
import 'a.dart';
|
||||
var b = a;
|
||||
''');
|
||||
|
||||
checkElementText(library, r'''
|
||||
library
|
||||
imports
|
||||
package:test/a.dart
|
||||
definingUnit
|
||||
topLevelVariables
|
||||
static b @21
|
||||
type: int
|
||||
shouldUseTypeForInitializerInference: false
|
||||
accessors
|
||||
synthetic static get b @-1
|
||||
returnType: int
|
||||
synthetic static set b= @-1
|
||||
parameters
|
||||
requiredPositional _b @-1
|
||||
type: int
|
||||
returnType: void
|
||||
''');
|
||||
}
|
||||
|
||||
test_variableInitializer_contextType_after_astRewrite() async {
|
||||
var library = await buildLibrary(r'''
|
||||
class A<T> {
|
||||
|
|
Loading…
Reference in a new issue