Skip to content

Commit

Permalink
Version 3.6.0-16.0.dev
Browse files Browse the repository at this point in the history
Merge af4c22f into dev
  • Loading branch information
Dart CI committed Jul 8, 2024
2 parents 1679aba + af4c22f commit 0ecada9
Show file tree
Hide file tree
Showing 43 changed files with 1,730 additions and 823 deletions.
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ vars = {
"material_color_utilities_rev": "799b6ba2f3f1c28c67cc7e0b4f18e0c7d7f3c03e",
"mime_rev": "11fec7d6df509a4efd554051cc27e3bf82df9c96",
"mockito_rev": "a7fdf7101fbd31132a59188a6057d21004345927",
"native_rev": "fcc783c1d2777555616dfc850f131878ea5d88a9", # mosum@ and dacoharkes@ are rolling breaking changes manually while the assets features are in experimental.
"native_rev": "cd8eddf8ad5b953127acf884f2b8a614482a8b0f", # mosum@ and dacoharkes@ are rolling breaking changes manually while the assets features are in experimental.
"package_config_rev": "903a0e528f91aef90821c8f5eaafbc1ae27198ab",
"path_rev": "e969f42ed112dd702a9453beb9df6c12ae2d3805",
"pool_rev": "924fb04353cec915d927f9f1aed88e2eda92b98a",
Expand Down Expand Up @@ -712,7 +712,7 @@ Var("dart_root") + "/third_party/pkg/tar":
"packages": [
{
"package": "chromium/fuchsia/gn-sdk",
"version": "RgErspyYHapUO2SpcW-vo2p8yaRUMUrq0eWjRVPfQjoC",
"version": "sbh76PYVTMxav4ACTgA-TXWcbZTZcWWjsqATCxrGIvwC",
}
],
"condition": 'download_fuchsia_deps',
Expand Down
2 changes: 2 additions & 0 deletions pkg/analysis_server/lib/src/status/diagnostics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,8 @@ class ContextsPage extends DiagnosticPageWithNav {
buf.write(')');
} else if (resolver is PackageMapUriResolver) {
writeMap(resolver.packageMap);
} else if (resolver is PackageConfigPackageUriResolver) {
writeMap(resolver.packageMap);
}
buf.write('</p>');
}
Expand Down
13 changes: 6 additions & 7 deletions pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3061,9 +3061,7 @@ class ExtensionElementImpl extends InstanceElementImpl

@override
PropertyAccessorElement? getGetter(String getterName) {
int length = accessors.length;
for (int i = 0; i < length; i++) {
PropertyAccessorElement accessor = accessors[i];
for (var accessor in augmented.accessors) {
if (accessor.isGetter && accessor.name == getterName) {
return accessor;
}
Expand All @@ -3073,9 +3071,7 @@ class ExtensionElementImpl extends InstanceElementImpl

@override
MethodElement? getMethod(String methodName) {
int length = methods.length;
for (int i = 0; i < length; i++) {
MethodElement method = methods[i];
for (var method in augmented.methods) {
if (method.name == methodName) {
return method;
}
Expand All @@ -3085,7 +3081,10 @@ class ExtensionElementImpl extends InstanceElementImpl

@override
PropertyAccessorElement? getSetter(String setterName) {
return InterfaceElementImpl.getSetterFromAccessors(setterName, accessors);
return InterfaceElementImpl.getSetterFromAccessors(
setterName,
augmented.accessors,
);
}
}

Expand Down
4 changes: 1 addition & 3 deletions pkg/analyzer/lib/src/error/codes.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7640,13 +7640,11 @@ class WarningCode extends AnalyzerErrorCode {
/// Parameters:
/// 0: the URI pointing to a nonexistent file
static const WarningCode URI_DOES_NOT_EXIST_IN_DOC_IMPORT = WarningCode(
'URI_DOES_NOT_EXIST',
'URI_DOES_NOT_EXIST_IN_DOC_IMPORT',
"Target of URI doesn't exist: '{0}'.",
correctionMessage:
"Try creating the file referenced by the URI, or try using a URI for a "
"file that does exist.",
hasPublishedDocs: true,
uniqueName: 'URI_DOES_NOT_EXIST_IN_DOC_IMPORT',
);

/// Parameters:
Expand Down
34 changes: 23 additions & 11 deletions pkg/analyzer/messages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17924,14 +17924,6 @@ CompileTimeErrorCode:
import [!'lib.dart'!];
```

If the file `lib.dart` doesn't exist, the following code produces this
diagnostic:

```dart
/// @docImport [!'lib.dart'!];
library;
```

#### Common fixes

If the URI was mistyped or invalid, then correct the URI.
Expand Down Expand Up @@ -27569,10 +27561,30 @@ WarningCode:
```

URI_DOES_NOT_EXIST_IN_DOC_IMPORT:
sharedName: URI_DOES_NOT_EXIST
problemMessage: "Target of URI doesn't exist: '{0}'."
correctionMessage: Try creating the file referenced by the URI, or try using a URI for a file that does exist.
hasPublishedDocs: true
hasPublishedDocs: false
comment: |-
Parameters:
0: the URI pointing to a nonexistent file
0: the URI pointing to a nonexistent file
documentation: |-
#### Description

The analyzer produces this diagnostic when a doc-import is found where
the URI refers to a file that doesn't exist.

#### Examples

If the file `lib.dart` doesn't exist, the following code produces this
diagnostic:

```dart
/// @docImport [!'lib.dart'!];
library;
```

#### Common fixes

If the URI was mistyped or invalid, then correct the URI.

If the URI is correct, then create the file.
86 changes: 86 additions & 0 deletions pkg/analyzer/test/src/dart/resolution/assignment_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1907,6 +1907,92 @@ AssignmentExpression
''');
}

test_prefixedIdentifier_ofExtensionName_augmentationAugments() async {
await assertNoErrorsInCode(r'''
extension A on int {
static set foo(int _) {}
}
augment extension A {
augment static set foo(int _) {}
}
void f() {
A.foo = 0;
}
''');

var node = findNode.singleAssignmentExpression;
assertResolvedNodeText(node, r'''
AssignmentExpression
leftHandSide: PrefixedIdentifier
prefix: SimpleIdentifier
token: A
staticElement: self::@extension::A
staticType: null
period: .
identifier: SimpleIdentifier
token: foo
staticElement: <null>
staticType: null
staticElement: <null>
staticType: null
operator: =
rightHandSide: IntegerLiteral
literal: 0
parameter: self::@extensionAugmentation::A::@setterAugmentation::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
writeElement: self::@extensionAugmentation::A::@setterAugmentation::foo
writeType: int
staticElement: <null>
staticType: int
''');
}

test_prefixedIdentifier_ofExtensionName_augmentationDeclares() async {
await assertNoErrorsInCode(r'''
extension A on int {}
augment extension A {
static set foo(int _) {}
}
void f() {
A.foo = 0;
}
''');

var node = findNode.singleAssignmentExpression;
assertResolvedNodeText(node, r'''
AssignmentExpression
leftHandSide: PrefixedIdentifier
prefix: SimpleIdentifier
token: A
staticElement: self::@extension::A
staticType: null
period: .
identifier: SimpleIdentifier
token: foo
staticElement: <null>
staticType: null
staticElement: <null>
staticType: null
operator: =
rightHandSide: IntegerLiteral
literal: 0
parameter: self::@extensionAugmentation::A::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
writeElement: self::@extensionAugmentation::A::@setter::foo
writeType: int
staticElement: <null>
staticType: int
''');
}

test_prefixedIdentifier_static_simple() async {
await assertNoErrorsInCode(r'''
class A {
Expand Down
154 changes: 154 additions & 0 deletions pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3424,6 +3424,160 @@ MethodInvocation
''');
}

test_hasReceiver_extension_staticGetter() async {
await assertNoErrorsInCode(r'''
extension A on int {
static double Function(int) get foo => throw Error();
}
void f() {
A.foo(0);
}
''');

var node = findNode.singleFunctionExpressionInvocation;
assertResolvedNodeText(node, r'''
FunctionExpressionInvocation
function: PropertyAccess
target: SimpleIdentifier
token: A
staticElement: self::@extension::A
staticType: null
operator: .
propertyName: SimpleIdentifier
token: foo
staticElement: self::@extension::A::@getter::foo
staticType: double Function(int)
staticType: double Function(int)
argumentList: ArgumentList
leftParenthesis: (
arguments
IntegerLiteral
literal: 0
parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
staticInvokeType: double Function(int)
staticType: double
''');
}

test_hasReceiver_extension_staticGetter_inAugmentation() async {
await assertNoErrorsInCode(r'''
extension A on int {}
augment extension A {
static double Function(int) get foo => throw Error();
}
void f() {
A.foo(0);
}
''');

var node = findNode.singleFunctionExpressionInvocation;
assertResolvedNodeText(node, r'''
FunctionExpressionInvocation
function: PropertyAccess
target: SimpleIdentifier
token: A
staticElement: self::@extension::A
staticType: null
operator: .
propertyName: SimpleIdentifier
token: foo
staticElement: self::@extensionAugmentation::A::@getter::foo
staticType: double Function(int)
staticType: double Function(int)
argumentList: ArgumentList
leftParenthesis: (
arguments
IntegerLiteral
literal: 0
parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
staticInvokeType: double Function(int)
staticType: double
''');
}

test_hasReceiver_extension_staticMethod() async {
await assertNoErrorsInCode(r'''
extension A on int {
static void foo(int _) {}
}
void f() {
A.foo(0);
}
''');

var node = findNode.singleMethodInvocation;
assertResolvedNodeText(node, r'''
MethodInvocation
target: SimpleIdentifier
token: A
staticElement: self::@extension::A
staticType: null
operator: .
methodName: SimpleIdentifier
token: foo
staticElement: self::@extension::A::@method::foo
staticType: void Function(int)
argumentList: ArgumentList
leftParenthesis: (
arguments
IntegerLiteral
literal: 0
parameter: self::@extension::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
staticType: void
''');
}

test_hasReceiver_extension_staticMethod_inAugmentation() async {
await assertNoErrorsInCode(r'''
extension A on int {}
augment extension A {
static void foo(int _) {}
}
void f() {
A.foo(0);
}
''');

var node = findNode.singleMethodInvocation;
assertResolvedNodeText(node, r'''
MethodInvocation
target: SimpleIdentifier
token: A
staticElement: self::@extension::A
staticType: null
operator: .
methodName: SimpleIdentifier
token: foo
staticElement: self::@extensionAugmentation::A::@method::foo
staticType: void Function(int)
argumentList: ArgumentList
leftParenthesis: (
arguments
IntegerLiteral
literal: 0
parameter: self::@extensionAugmentation::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
staticType: void
''');
}

test_hasReceiver_extensionTypeName() async {
await assertNoErrorsInCode(r'''
extension type A(int it) {
Expand Down
Loading

0 comments on commit 0ecada9

Please sign in to comment.