Version 2.14.0-210.0.dev
Merge commit '00d39e0f6ca057ca81a710b13f459154031bb9dc' into 'dev'
diff --git a/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
index 72d171e..98832a4 100644
--- a/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
@@ -10,7 +10,6 @@
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/extensions.dart';
-import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/element/type_algebra.dart';
@@ -32,17 +31,8 @@
void resolve(AnnotationImpl node,
List<Map<DartType, NonPromotionReason> Function()> whyNotPromotedList) {
- AstNode parent = node.parent;
-
node.typeArguments?.accept(_resolver);
_resolve(node, whyNotPromotedList);
-
- var elementAnnotationImpl =
- node.elementAnnotation as ElementAnnotationImpl?;
- if (elementAnnotationImpl == null) {
- // Analyzer ignores annotations on "part of" directives.
- assert(parent is PartDirective || parent is PartOfDirective);
- }
}
void _classConstructorInvocation(
diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
index 10c3167..6a03d38 100644
--- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
@@ -851,6 +851,12 @@
}
@override
+ void visitPartOfDirective(PartOfDirective node) {
+ _createElementAnnotations(node.metadata);
+ super.visitPartOfDirective(node);
+ }
+
+ @override
void visitSimpleFormalParameter(covariant SimpleFormalParameterImpl node) {
ParameterElementImpl element;
if (node.parent is DefaultFormalParameter) {
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 87c0e77..bd69138 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -409,6 +409,11 @@
}
@override
+ void visitPartOfDirective(PartOfDirective node) {
+ _resolveAnnotations(node.metadata);
+ }
+
+ @override
void visitRedirectingConstructorInvocation(
covariant RedirectingConstructorInvocationImpl node) {
var enclosingClass = _resolver.enclosingClass;
diff --git a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
index 07af5c1..730e36a 100644
--- a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
@@ -27,6 +27,59 @@
return findElement.importFind('package:test/a.dart');
}
+ test_location_partDirective() async {
+ newFile('$testPackageLibPath/a.dart', content: r'''
+part of 'test.dart';
+''');
+
+ await assertNoErrorsInCode(r'''
+@foo
+part 'a.dart';
+const foo = 42;
+''');
+
+ var annotation = findNode.annotation('@foo');
+ assertElement2(
+ annotation,
+ declaration: findElement.topGet('foo'),
+ );
+
+ var annotationElement = annotation.elementAnnotation!;
+ _assertElementAnnotationValueText(annotationElement, r'''
+int 42
+''');
+ }
+
+ test_location_partOfDirective() async {
+ var libPath = newFile('$testPackageLibPath/lib.dart', content: r'''
+part 'part.dart';
+''').path;
+
+ var partPath = newFile('$testPackageLibPath/part.dart', content: r'''
+@foo
+part of 'lib.dart';
+const foo = 42;
+void f() {}
+''').path;
+
+ // Resolve the library, so that the part knows its library.
+ await resolveFile2(libPath);
+
+ await resolveFile2(partPath);
+ assertNoErrorsInResult();
+
+ var annotation = findNode.annotation('@foo');
+ assertElement2(
+ annotation,
+ declaration: findElement.topGet('foo'),
+ );
+
+ var annotationElement = annotation.elementAnnotation!;
+ _assertElementAnnotationValueText(annotationElement, r'''
+int 42
+''');
+ }
+
test_onFieldFormal() async {
await assertNoErrorsInCode(r'''
class A {
diff --git a/pkg/analyzer/test/src/dart/resolution/simple_identifier_test.dart b/pkg/analyzer/test/src/dart/resolution/simple_identifier_test.dart
index 4a33901..d47a2dc 100644
--- a/pkg/analyzer/test/src/dart/resolution/simple_identifier_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/simple_identifier_test.dart
@@ -10,13 +10,59 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(SimpleIdentifierResolutionTest);
- defineReflectiveTests(SimpleIdentifierResolutionWithNullSafetyTest);
+ defineReflectiveTests(SimpleIdentifierResolutionWithoutNullSafetyTest);
});
}
@reflectiveTest
class SimpleIdentifierResolutionTest extends PubPackageResolutionTest
- with WithoutNullSafetyMixin {
+ with SimpleIdentifierResolutionTestCases {
+ test_functionReference() async {
+ await assertErrorsInCode('''
+// @dart = 2.7
+import 'dart:math';
+
+class A {
+ const A(_);
+}
+
+@A([min])
+main() {}
+''', [
+ error(CompileTimeErrorCode.COULD_NOT_INFER, 66, 5),
+ ]);
+
+ var identifier = findNode.simple('min]');
+ assertElement(
+ identifier,
+ elementMatcher(
+ findElement.importFind('dart:math').topFunction('min'),
+ isLegacy: true,
+ ),
+ );
+ assertType(identifier, 'T* Function<T extends num*>(T*, T*)*');
+ }
+
+ test_implicitCall_tearOff_nullable() async {
+ await assertErrorsInCode('''
+class A {
+ int call() => 0;
+}
+
+int Function() foo(A? a) {
+ return a;
+}
+''', [
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 68, 1),
+ ]);
+
+ var identifier = findNode.simple('a;');
+ assertElement(identifier, findElement.parameter('a'));
+ assertType(identifier, 'A?');
+ }
+}
+
+mixin SimpleIdentifierResolutionTestCases on PubPackageResolutionTest {
test_dynamic_explicitCore() async {
await assertNoErrorsInCode(r'''
import 'dart:core';
@@ -141,49 +187,6 @@
}
@reflectiveTest
-class SimpleIdentifierResolutionWithNullSafetyTest
- extends SimpleIdentifierResolutionTest with WithNullSafetyMixin {
- test_functionReference() async {
- await assertErrorsInCode('''
-// @dart = 2.7
-import 'dart:math';
-
-class A {
- const A(_);
-}
-
-@A([min])
-main() {}
-''', [
- error(CompileTimeErrorCode.COULD_NOT_INFER, 66, 5),
- ]);
-
- var identifier = findNode.simple('min]');
- assertElement(
- identifier,
- elementMatcher(
- findElement.importFind('dart:math').topFunction('min'),
- isLegacy: true,
- ),
- );
- assertType(identifier, 'T* Function<T extends num*>(T*, T*)*');
- }
-
- test_implicitCall_tearOff_nullable() async {
- await assertErrorsInCode('''
-class A {
- int call() => 0;
-}
-
-int Function() foo(A? a) {
- return a;
-}
-''', [
- error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 68, 1),
- ]);
-
- var identifier = findNode.simple('a;');
- assertElement(identifier, findElement.parameter('a'));
- assertType(identifier, 'A?');
- }
-}
+class SimpleIdentifierResolutionWithoutNullSafetyTest
+ extends PubPackageResolutionTest
+ with SimpleIdentifierResolutionTestCases, WithoutNullSafetyMixin {}
diff --git a/runtime/vm/compiler/ffi/unit_tests/int8x10/arm64_macos.expect b/runtime/vm/compiler/ffi/unit_tests/int8x10/arm64_macos.expect
index 8efadc4..f8d22bc 100644
--- a/runtime/vm/compiler/ffi/unit_tests/int8x10/arm64_macos.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/int8x10/arm64_macos.expect
@@ -1,12 +1,12 @@
-r0 int8
-r1 int8
-r2 int8
-r3 int8
-r4 int8
-r5 int8
-r6 int8
-r7 int8
+r0 int32[int8]
+r1 int32[int8]
+r2 int32[int8]
+r3 int32[int8]
+r4 int32[int8]
+r5 int32[int8]
+r6 int32[int8]
+r7 int32[int8]
S+0 int8
S+1 int8
=>
-r0 int8
+r0 int32[int8]
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/arm64_macos.expect b/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/arm64_macos.expect
index da95987..e62e479 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/arm64_macos.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/arm64_macos.expect
@@ -9,7 +9,7 @@
S+96 Struct(size: 16)
S+112 Struct(size: 16)
S+128 float
-r0 int8
+r0 int32[int8]
S+132 Struct(size: 16)
=>
M(v0 float, v1 float, v2 float, v3 float) Struct(size: 16)
diff --git a/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/arm64_macos.expect b/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/arm64_macos.expect
index c2dcf8c..198d331 100644
--- a/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/arm64_macos.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/arm64_macos.expect
@@ -7,7 +7,7 @@
S+64 Union(size: 16)
S+80 Union(size: 16)
S+96 Union(size: 16)
-r0 int8
+r0 int32[int8]
S+112 Union(size: 16)
=>
M(v0 float, v1 float, v2 float, v3 float) Union(size: 16)
diff --git a/runtime/vm/constants_arm64.h b/runtime/vm/constants_arm64.h
index 9b93a3a..91ff40e 100644
--- a/runtime/vm/constants_arm64.h
+++ b/runtime/vm/constants_arm64.h
@@ -449,7 +449,7 @@
// Whether 1 or 2 byte-sized arguments or return values are passed extended
// to 4 bytes.
-#if defined(TARGET_OS_MACOS_IOS)
+#if defined(TARGET_OS_MACOS_IOS) || defined(TARGET_OS_MACOS)
static constexpr ExtensionStrategy kReturnRegisterExtension = kExtendedTo4;
static constexpr ExtensionStrategy kArgumentRegisterExtension = kExtendedTo4;
#else
diff --git a/tools/VERSION b/tools/VERSION
index e431238..665452b 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 209
+PRERELEASE 210
PRERELEASE_PATCH 0
\ No newline at end of file