Skip to content

Commit

Permalink
Version 3.8.0-35.0.dev
Browse files Browse the repository at this point in the history
Merge 4c3e7ab into dev
  • Loading branch information
Dart CI committed Jan 24, 2025
2 parents 419170a + 4c3e7ab commit 7b1c1f7
Show file tree
Hide file tree
Showing 147 changed files with 781 additions and 338 deletions.
18 changes: 9 additions & 9 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ vars = {
# 'tools/rev_sdk_deps.dart' can rev pkg dependencies to their latest; put an
# EOL comment after a dependency to disable this and pin it at its current
# revision.
"core_rev": "7a71ad6b9170e09d5cbe39f3fccdee648659f1e7",
"dartdoc_rev": "e1295863b11c54680bf178ec9c2662a33b0e24be",
"ecosystem_rev": "efe4ee4af6ac2e4c90aa525fae213b65c97295a9",
"core_rev": "72a206037105100fc2d6170629f6060733f1427d",
"dartdoc_rev": "e1295863b11c54680bf178ec9c2662a33b0e24be", # https://github.com/dart-lang/dartdoc/issues/3969
"ecosystem_rev": "682c8efee7e752e83ed46aee6963791f314b3d46",
"flute_rev": "e4ea0459a7debae5e9592c85141707b01fac86c9",
"glob_rev": "eee18d1a577d5f965f6afbbd251798e065dced43",
"glob_rev": "043796be996190473b397fa2fecfa34bb91376fb",
"http_rev": "6d99ff5755d3581f44ce5c18bb029a2fa1ef0eaf",
"intl_rev": "5d65e3808ce40e6282e40881492607df4e35669f",
"leak_tracker_rev": "f5620600a5ce1c44f65ddaa02001e200b096e14c", # manually rolled
Expand All @@ -144,15 +144,15 @@ vars = {
"native_rev": "c817a5e41220de370cbea6e6445e63cdc7087544", # disable tools/rev_sdk_deps.dart
"protobuf_rev": "b7dd58cdbd879beee4c3fbf8ee80fce8e97bad26",
"pub_rev": "710265bae23ad5860f33287fba10b5c369f19a93", # disable tools/rev_sdk_deps.dart
"shelf_rev": "bf799519cda2898a7c5af06dcfdd5fe6443afd79",
"shelf_rev": "2a7442f7d6d3e63fdc7b387128619b263dcb7e78",
"sync_http_rev": "47e6b264a209d0d806cfe9cdad8b6c69ce231986",
"tar_rev": "5a1ea943e70cdf3fa5e1102cdbb9418bd9b4b81a",
"test_rev": "f364fc8291d668d85c702a5b9f9a4f2e5c1ade0e",
"tools_rev": "92114ab8a16eef77be1cd7bad3f5af28b5b1dc63",
"test_rev": "7fc9521875b5ec9484dd31624f5e3ed2791050b1",
"tools_rev": "3bdef2043af9244b804adc08896bf96d51bb49ba",
"vector_math_rev": "bd4b574b2a457a3955d223694f1a979a0c0f38c9",
"web_rev": "af5de5e8548060c0795713ee7129ba6d5ff9f1b2",
"web_rev": "fd3d9889a6b5ab777f6116b4972d76277e4a6404",
"web_socket_channel_rev": "a937243563e8ee75d11fb23610297d4f6e5cb2b9",
"webdev_rev": "e72f365a4408dce73bc023e624adc6a9a72dd7a2",
"webdev_rev": "9430dd7df15e9499648d6e5b1e83382672433d18",
"webdriver_rev": "d83d6a3cbaab152ff9b99b29382d1f48b5d5ba23",
"webkit_inspection_protocol_rev": "effa75205516757795683d527c3dea9546eb0c32",

Expand Down
4 changes: 2 additions & 2 deletions pkg/analysis_server/lib/src/plugin2/analyzer_version.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

/// The version of the analyzer_plugin package that matches the analyzer_plugin
/// code used by the analysis_server package.
var analyzerPluginVersion = '0.12.0';
var analyzerPluginVersion = '0.13.0';

/// The version of the analyzer package that matches the analyzer code used by
/// the analysis_server package.
var analyzerVersion = '7.0.0';
var analyzerVersion = '7.2.0';
Original file line number Diff line number Diff line change
Expand Up @@ -4024,9 +4024,10 @@ extension on AstNode {
while (enclosingMember != null) {
if (enclosingMember is MethodDeclaration) {
return enclosingMember.isStatic;
} else if (enclosingMember is FunctionBody &&
enclosingMember.parent is ConstructorDeclaration) {
return false;
} else if (enclosingMember.parent case ConstructorDeclaration(
:var factoryKeyword,
) when enclosingMember is FunctionBody) {
return factoryKeyword != null;
} else if (enclosingMember is VariableDeclarationList &&
enclosingMember.parent is FieldDeclaration) {
return !enclosingMember.isLate;
Expand Down
32 changes: 23 additions & 9 deletions pkg/analysis_server/test/analysis_server_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ abstract class ContextResolutionTest with ResourceProviderMixin {
/// implementation are still fully verified.
static final MemoryByteStore _sharedByteStore = MemoryByteStore();

/// The next ID to use in a request to the server.
var nextRequestId = 0;

MemoryByteStore _byteStore = _sharedByteStore;

final TestPluginManager pluginManager = TestPluginManager();
Expand Down Expand Up @@ -148,15 +151,21 @@ abstract class ContextResolutionTest with ResourceProviderMixin {
handleSuccessfulRequest(
AnalysisSetPriorityFilesParams(
files.map((e) => e.path).toList(),
).toRequest('0', clientUriConverter: server.uriConverter),
).toRequest(
'${nextRequestId++}',
clientUriConverter: server.uriConverter,
),
);
}

Future<void> setPriorityFiles2(List<File> files) async {
await handleSuccessfulRequest(
AnalysisSetPriorityFilesParams(
files.map((e) => e.path).toList(),
).toRequest('0', clientUriConverter: server.uriConverter),
).toRequest(
'${nextRequestId++}',
clientUriConverter: server.uriConverter,
),
);
}

Expand All @@ -171,7 +180,10 @@ abstract class ContextResolutionTest with ResourceProviderMixin {
includedConverted,
excludedConverted,
packageRoots: {},
).toRequest('0', clientUriConverter: server.uriConverter),
).toRequest(
'${nextRequestId++}',
clientUriConverter: server.uriConverter,
),
);
}

Expand Down Expand Up @@ -214,9 +226,10 @@ abstract class ContextResolutionTest with ResourceProviderMixin {

Future<void> _setGeneralAnalysisSubscriptions() async {
await handleSuccessfulRequest(
AnalysisSetGeneralSubscriptionsParams(
_analysisGeneralServices,
).toRequest('0', clientUriConverter: server.uriConverter),
AnalysisSetGeneralSubscriptionsParams(_analysisGeneralServices).toRequest(
'${nextRequestId++}',
clientUriConverter: server.uriConverter,
),
);
}
}
Expand Down Expand Up @@ -264,9 +277,10 @@ class PubPackageAnalysisServerTest extends ContextResolutionTest
) async {
(_analysisFileSubscriptions[service] ??= []).add(file.path);
await handleSuccessfulRequest(
AnalysisSetSubscriptionsParams(
_analysisFileSubscriptions,
).toRequest('0', clientUriConverter: server.uriConverter),
AnalysisSetSubscriptionsParams(_analysisFileSubscriptions).toRequest(
'${nextRequestId++}',
clientUriConverter: server.uriConverter,
),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ abstract class LspOverLegacyTest extends PubPackageAnalysisServerTest
LspEditHelpersMixin,
LspVerifyEditHelpersMixin,
ClientCapabilitiesHelperMixin {
/// The next ID to use a request to the server.
var _nextRequestId = 0;

/// The last ID that was used for a legacy request.
late String lastSentLegacyRequestId;

Expand Down Expand Up @@ -207,7 +204,7 @@ abstract class LspOverLegacyTest extends PubPackageAnalysisServerTest
AnalysisUpdateContentParams({
convertPath(filePath): AddContentOverlay(content),
}).toRequest(
'${_nextRequestId++}',
'${nextRequestId++}',
clientUriConverter: server.uriConverter,
),
);
Expand Down Expand Up @@ -241,7 +238,7 @@ abstract class LspOverLegacyTest extends PubPackageAnalysisServerTest
/// Creates a legacy request with an auto-assigned ID.
Request createLegacyRequest(RequestParams params) {
return params.toRequest(
'${_nextRequestId++}',
'${nextRequestId++}',
clientUriConverter: server.uriConverter,
);
}
Expand Down Expand Up @@ -323,7 +320,7 @@ abstract class LspOverLegacyTest extends PubPackageAnalysisServerTest
AnalysisUpdateContentParams({
convertPath(filePath): RemoveContentOverlay(),
}).toRequest(
'${_nextRequestId++}',
'${nextRequestId++}',
clientUriConverter: server.uriConverter,
),
);
Expand All @@ -341,7 +338,7 @@ abstract class LspOverLegacyTest extends PubPackageAnalysisServerTest
var request = ServerSetClientCapabilitiesParams(
[],
lspCapabilities: clientCapabilities,
).toRequest('${_nextRequestId++}', clientUriConverter: server.uriConverter);
).toRequest('${nextRequestId++}', clientUriConverter: server.uriConverter);

await handleSuccessfulRequest(request);
}
Expand Down Expand Up @@ -377,7 +374,7 @@ abstract class LspOverLegacyTest extends PubPackageAnalysisServerTest
AnalysisUpdateContentParams({
convertPath(filePath): ChangeContentOverlay([edit]),
}).toRequest(
'${_nextRequestId++}',
'${nextRequestId++}',
clientUriConverter: server.uriConverter,
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ class ConstructorDeclarationTest extends AbstractCompletionDriverTest
with ConstructorDeclarationTestCases {}

mixin ConstructorDeclarationTestCases on AbstractCompletionDriverTest {
Future<void> test_factory_noInstanceValues() async {
await computeSuggestions('''
class A {
A();
factory A.n() {
^
return A();
}
bool isEmpty = false;
}
''');
assertNoSuggestion(completion: 'isEmpty');
}

Future<void> test_factory_redirectedConstructor_afterName() async {
await computeSuggestions('''
class A {
Expand Down
6 changes: 3 additions & 3 deletions pkg/analysis_server_plugin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ environment:
sdk: '>=3.3.0 <4.0.0'

dependencies:
_fe_analyzer_shared: ^77.0.0
analyzer: ^7.0.0
analyzer_plugin: ^0.12.0
_fe_analyzer_shared: ^79.0.0
analyzer: ^7.2.0
analyzer_plugin: ^0.13.0
meta: ^1.16.0

# Use 'any' constraints here; we get our versions from the DEPS file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ class Name {
}

if (name.startsWith('_')) {
var libraryUri = element.firstFragment.libraryFragment!.source.uri;
var libraryUri = element.library2!.uri;
return Name(libraryUri, name);
} else {
return Name(null, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ class ExtensionMemberResolver {
/// returns [ExtensionResolutionError.ambiguous].
ExtensionResolutionResult findExtension(
TypeImpl type, SyntacticEntity nameEntity, Name name) {
var aaa = _resolver.libraryFragment.accessibleExtensions2;
var bbb = aaa.havingMemberWithBaseName(name).toList();
var extensions = bbb.applicableTo(
targetLibrary: _resolver.definingLibrary,
targetType: type,
);
var extensions = _resolver.libraryFragment.accessibleExtensions2
.havingMemberWithBaseName(name)
.toList()
.applicableTo(
targetLibrary: _resolver.definingLibrary,
targetType: type,
);

if (extensions.isEmpty) {
return ExtensionResolutionError.none;
Expand Down
67 changes: 67 additions & 0 deletions pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,73 @@ MethodInvocation
''');
}

test_instance_method_fromInstance_privateName() async {
await assertNoErrorsInCode('''
extension E on int {
void _foo() {}
}
void f() {
0._foo();
}
''');
var invocation = findNode.methodInvocation('_foo();');
assertResolvedNodeText(invocation, r'''
MethodInvocation
target: IntegerLiteral
literal: 0
staticType: int
operator: .
methodName: SimpleIdentifier
token: _foo
staticElement: <testLibraryFragment>::@extension::E::@method::_foo
element: <testLibraryFragment>::@extension::E::@method::_foo#element
staticType: void Function()
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
staticInvokeType: void Function()
staticType: void
''');
}

test_instance_method_fromInstance_privateName_inPart() async {
newFile('$testPackageLibPath/a.dart', r'''
part of 'test.dart';
extension E on int {
void _foo() {}
}
''');

await assertNoErrorsInCode('''
part 'a.dart';
void f() {
0._foo();
}
''');

var invocation = findNode.methodInvocation('_foo();');
assertResolvedNodeText(invocation, r'''
MethodInvocation
target: IntegerLiteral
literal: 0
staticType: int
operator: .
methodName: SimpleIdentifier
token: _foo
staticElement: <testLibrary>::@fragment::package:test/a.dart::@extension::E::@method::_foo
element: <testLibrary>::@fragment::package:test/a.dart::@extension::E::@method::_foo#element
staticType: void Function()
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
staticInvokeType: void Function()
staticType: void
''');
}

test_instance_method_specificSubtypeMatchLocal() async {
await assertNoErrorsInCode('''
class A {}
Expand Down
2 changes: 2 additions & 0 deletions pkg/dartdev/lib/src/commands/analyze.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ class AnalyzeCommand extends DartdevCommand {
io.exit(_Result.crash.exitCode);
});

// Note that we could be awaiting `null` here, if
// `AnalysisServer._analysisFinished` has not been initialized yet.
await server.analysisFinished;
analysisFinished = true;

Expand Down
29 changes: 16 additions & 13 deletions pkg/dev_compiler/test/hot_reload_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,10 @@ abstract class HotReloadSuiteRunner {
}
final previousTempUri = generatedCodeDir.uri.resolve('__previous');
final currentTempUri = generatedCodeDir.uri.resolve('__current');
File.fromUri(previousTempUri).writeAsStringSync(previousCode);
File.fromUri(currentTempUri).writeAsStringSync(currentCode);
// Avoid 'No newline at end of file' messages in the output by
// appending a newline to the trimmed source code strings.
File.fromUri(previousTempUri).writeAsStringSync('$previousCode\n');
File.fromUri(currentTempUri).writeAsStringSync('$currentCode\n');
final diffOutput = _diffWithFileUris(
previousTempUri, currentTempUri,
label: test.name);
Expand Down Expand Up @@ -623,16 +625,18 @@ abstract class HotReloadSuiteRunner {
(currentCode, currentDiff) = _splitTestByDiff(currentEdit.fileUri);
final previousTempUri = generatedCodeDir.uri.resolve('__previous');
final currentTempUri = generatedCodeDir.uri.resolve('__current');
File.fromUri(previousTempUri).writeAsStringSync(previousCode);
File.fromUri(currentTempUri).writeAsStringSync(currentCode);
// Avoid 'No newline at end of file' messages in the output by
// appending a newline to the trimmed source code strings.
File.fromUri(previousTempUri).writeAsStringSync('$previousCode\n');
File.fromUri(currentTempUri).writeAsStringSync('$currentCode\n');
final diffOutput = _diffWithFileUris(
previousTempUri, currentTempUri,
label: test.name);
File.fromUri(previousTempUri).deleteSync();
File.fromUri(currentTempUri).deleteSync();
final newCurrentText = '$currentCode'
'${currentCode.endsWith('\n') ? '' : '\n'}'
'$diffOutput\n';
// Write an empty line between the code and the diff comment to
// agree with the dart formatter.
final newCurrentText = '$currentCode\n\n$diffOutput\n';
File.fromUri(currentEdit.fileUri).writeAsStringSync(newCurrentText);
_print('Writing updated diff to $currentEdit.fileUri',
label: test.name);
Expand Down Expand Up @@ -943,16 +947,15 @@ abstract class HotReloadSuiteRunner {
return (diff1Lines.join('\n'), diff2Lines.join('\n'));
}

/// Returns the code and diff portions of [file].
/// Returns the code and diff portions of [file] with all leading and trailing
/// whitespace trimmed.
(String, String) _splitTestByDiff(Uri file) {
final text = File.fromUri(file).readAsStringSync();
final diffIndex = text.indexOf(testDiffSeparator);
final diffSplitIndex = diffIndex == -1 ? text.length - 1 : diffIndex;
final codeText = text.substring(0, diffSplitIndex);
final diffText = text.substring(diffSplitIndex, text.length - 1);
// Avoid 'No newline at end of file' messages in the output by appending a
// newline if one is not already trailing.
return ('$codeText${codeText.endsWith('\n') ? '' : '\n'}', diffText);
final codeText = text.substring(0, diffSplitIndex).trim();
final diffText = text.substring(diffSplitIndex, text.length - 1).trim();
return (codeText, diffText);
}
}

Expand Down
Loading

0 comments on commit 7b1c1f7

Please sign in to comment.