Skip to content

Commit

Permalink
Version 3.7.0-250.0.dev
Browse files Browse the repository at this point in the history
Merge 96d18ba into dev
  • Loading branch information
Dart CI committed Dec 13, 2024
2 parents cfc72e1 + 96d18ba commit 9a213cc
Show file tree
Hide file tree
Showing 21 changed files with 125 additions and 151 deletions.
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ vars = {
### /third_party/ dependencies

# Prefer to use hashes of binaryen that have been reviewed & rolled into g3.
"binaryen_rev" : "93883fde36ac158fd415dcd6dbd387dcfd928d3c",
"binaryen_rev" : "87f9dac127b387715d8d96ac7ec8fd469d8c2dab",
"boringssl_rev": "57f525e425a95e7c89fa2df926fa93273bd47311",
"browser-compat-data_tag": "ac8cae697014da1ff7124fba33b0b4245cc6cd1b", # v1.0.22
"cpu_features_rev": "936b9ab5515dead115606559502e3864958f7f6e",
Expand Down Expand Up @@ -147,7 +147,7 @@ vars = {
"package_config_rev": "76f2f6c245451da1fa24d7bbb00251b909e729a5",
"pool_rev": "f85209d83cb0aa3c5612ed80de32df51ba580abd",
"protobuf_rev": "da7279c56734cffed4deb1e3a6f93bdcefccf6b8",
"pub_rev": "7745ee72d7089515cf0de04709504839609b896e", # disable tools/rev_sdk_deps.dart
"pub_rev": "58de642dc1d07601f6eb2b4ecd94555c0210106b", # disable tools/rev_sdk_deps.dart
"pub_semver_rev": "8e9fcb9d3f89f06022387f906da4d380688f935c",
"shelf_rev": "2b5b683e78f5cc84e479a43297fd7b5489d7db02",
"source_maps_rev": "198d32bbde2f5736c04dfbab306a17096fd1648b",
Expand Down
1 change: 0 additions & 1 deletion pkg/analysis_server/analyzer_use_new_elements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ lib/src/services/search/search_engine.dart
lib/src/services/search/search_engine_internal.dart
test/abstract_single_unit.dart
test/services/refactoring/legacy/abstract_rename.dart
test/services/refactoring/legacy/rename_import_test.dart
test/services/search/element_visitors_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
Expand Down Expand Up @@ -237,6 +238,8 @@ void f() {

void _createRefactoring(String search) {
var directive = findNode.import(search);
createRenameRefactoringForElement(directive.element);
createRenameRefactoringForElement2(
directive.libraryImport as LibraryImportElementImpl,
);
}
}
6 changes: 1 addition & 5 deletions pkg/analyzer/lib/src/fasta/error_converter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,7 @@ class FastaErrorReporter {
);
return;
case "YIELD_IN_NON_GENERATOR":
errorReporter?.atOffset(
offset: offset,
length: length,
errorCode: CompileTimeErrorCode.YIELD_IN_NON_GENERATOR,
);
// Reported by [YieldStatementResolver._resolve_notGenerator]
return;
case "BUILT_IN_IDENTIFIER_IN_DECLARATION":
// Reported by [ErrorVerifier._checkForBuiltInIdentifierAsName].
Expand Down
2 changes: 2 additions & 0 deletions pkg/analyzer/lib/src/utilities/extensions/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ extension Element2OrNullExtension on Element2? {
return element2.asElement;
case LibraryElementImpl():
return self as Element;
case LibraryImportElementImpl():
return self as Element;
case LocalFunctionElementImpl():
return self.wrappedElement as Element;
case LocalVariableElementImpl2():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ main() {

@reflectiveTest
class YieldEachInNonGeneratorTest extends PubPackageResolutionTest {
@FailingTest(
reason: 'We are currently trying to parse the yield statement as a '
'binary expression.')
test_async() async {
await assertErrorsInCode(r'''
f() async {
yield* 0;
}
''', [
error(CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR, 0, 0),
error(CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR, 14, 9),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ main() {

@reflectiveTest
class YieldInNonGeneratorTest extends PubPackageResolutionTest {
@FailingTest(
reason: 'We are currently trying to parse the yield statement as a '
'binary expression.')
test_async() async {
await assertErrorsInCode(r'''
f() async {
yield 0;
}
''', [
error(CompileTimeErrorCode.YIELD_IN_NON_GENERATOR, 0, 0),
error(CompileTimeErrorCode.YIELD_IN_NON_GENERATOR, 14, 8),
]);
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/dds/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
.packages
build/
pubspec.lock
*.code-workspace
logs/
12 changes: 11 additions & 1 deletion pkg/dds/lib/devtools_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class DevToolsServer {
);

handler ??= await defaultHandler(
buildDir: customDevToolsPath!,
buildDir: customDevToolsPath,
clientManager: clientManager,
dtd: dtdInfo,
devtoolsExtensionsManager: ExtensionsManager(),
Expand Down Expand Up @@ -336,6 +336,16 @@ class DevToolsServer {
server.defaultResponseHeaders.add('origin-agent-cluster', '?1');
}

// This is only true when the DevTools server is started through the
// tool/devtools_server/serve_local.dart script. This is required to allow
// connecting a debug instance of DevTools app to a running DevTools server.
if (Platform.script.toString().endsWith('serve_local.dart')) {
server.defaultResponseHeaders.add(
HttpHeaders.accessControlAllowOriginHeader,
'*',
);
}

// Ensure browsers don't cache older versions of the app.
server.defaultResponseHeaders.add(
HttpHeaders.cacheControlHeader,
Expand Down
22 changes: 12 additions & 10 deletions pkg/dds/lib/src/devtools/handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import 'utils.dart';
/// client that is not the DevTools server (e.g. an IDE).
FutureOr<Handler> defaultHandler({
DartDevelopmentServiceImpl? dds,
required String buildDir,
String? buildDir,
ClientManager? clientManager,
Handler? notFoundHandler,
DtdInfo? dtd,
Expand All @@ -55,15 +55,6 @@ FutureOr<Handler> defaultHandler({
appRoot = '/${dds!.authCode}$appRoot';
}

const defaultDocument = 'index.html';
final indexFile = File(path.join(buildDir, defaultDocument));

// Serves the static web assets for DevTools.
final devtoolsStaticAssetHandler = createStaticHandler(
buildDir,
defaultDocument: defaultDocument,
);

/// A wrapper around [devtoolsStaticAssetHandler] that handles serving
/// index.html up for / and non-file requests like /memory, /inspector, etc.
/// with the correct base href for the DevTools root.
Expand Down Expand Up @@ -106,6 +97,12 @@ FutureOr<Handler> defaultHandler({
}
}

if (buildDir == null) {
return Response.notFound('No build directory was specified.');
}

const defaultDocument = 'index.html';
final indexFile = File(path.join(buildDir, defaultDocument));
final isValidRootPage = pathSegments.isEmpty ||
(pathSegments.length == 1 && !pathSegments[0].contains('.'));

Expand All @@ -118,6 +115,11 @@ FutureOr<Handler> defaultHandler({
);
}

// Serves the static web assets for DevTools.
final devtoolsStaticAssetHandler = createStaticHandler(
buildDir,
defaultDocument: defaultDocument,
);
return devtoolsStaticAssetHandler(request);
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/dds/tool/devtools_server/serve_local.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ void main(List<String> args) {
argDevToolsBuild,
help: 'The location of the DevTools build to serve from DevTools server '
'(e.g. --devtools-build=absolute/path/to/devtools/build).',
mandatory: true,
);

try {
final ArgResults argResults = argParser.parse(args);
unawaited(
DevToolsServer().serveDevToolsWithArgs(
_removeDevToolsBuildOption(args),
customDevToolsPath: argResults[argDevToolsBuild],
customDevToolsPath: argResults.wasParsed(argDevToolsBuild)
? argResults[argDevToolsBuild]
: null,
),
);
} on FormatException catch (e) {
Expand Down
2 changes: 0 additions & 2 deletions runtime/tests/concurrency/stress_test_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,6 @@
"../../../tests/language/assert/with_type_test_or_cast_test.dart",
"../../../tests/language/assign/instance_method_test.dart",
"../../../tests/language/assign/op_test.dart",
"../../../tests/language/assign/static_type_runtime_test.dart",
"../../../tests/language/assign/to_type_runtime_test.dart",
"../../../tests/language/async/and_or_test.dart",
"../../../tests/language/async/async_test.dart",
"../../../tests/language/async/await_catch_regression_test.dart",
Expand Down
5 changes: 5 additions & 0 deletions runtime/vm/dart_api_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2795,6 +2795,11 @@ DART_EXPORT Dart_Handle Dart_GetStaticMethodClosure(Dart_Handle library,
return Api::NewError(
"function_name must be the name of a regular function.");
}

if (FLAG_verify_entry_points) {
CHECK_ERROR_HANDLE(func.VerifyEntryPoint(EntryPointPragma::kGetterOnly));
}

func = func.ImplicitClosureFunction();
if (func.IsNull()) {
return Dart_Null();
Expand Down
41 changes: 31 additions & 10 deletions runtime/vm/dart_api_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1270,17 +1270,29 @@ TEST_CASE(DartAPI_ClosureFunction) {
}

TEST_CASE(DartAPI_GetStaticMethodClosure) {
const char* kScriptChars =
"class Foo {\n"
" static int getInt() {\n"
" return 1;\n"
" }\n"
" double getDouble() {\n"
" return 1.0;\n"
" }\n"
"}\n";
const char* kScriptChars = R"(
@pragma("vm:entry-point")
class Foo {
static int getIntNoAnnotation() {
return 1;
}
@pragma("vm:entry-point", "call")
static int getIntCallOnly() {
return 1;
}
@pragma("vm:entry-point", "get")
static int getInt() {
return 1;
}
@pragma("vm:entry-point", "get")
double getDouble() {
return 1.0;
}
}
)";
// Ensure entry points are checked.
SetFlagScope<bool> sfs(&FLAG_verify_entry_points, true);
// Create a test library and Load up a test script in it.
SetFlagScope<bool> sfs(&FLAG_verify_entry_points, false);
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
EXPECT_VALID(lib);
Dart_Handle foo_cls = Dart_GetClass(lib, NewString("Foo"));
Expand Down Expand Up @@ -1321,6 +1333,15 @@ TEST_CASE(DartAPI_GetStaticMethodClosure) {
EXPECT_ERROR(Dart_GetStaticMethodClosure(lib, foo_cls, Dart_Null()),
"Dart_GetStaticMethodClosure expects argument 'function_name' "
"to be non-null.");
EXPECT_ERROR(
Dart_GetStaticMethodClosure(lib, foo_cls,
NewString("getIntNoAnnotation")),
"To closurize 'file:///test-lib::Foo.getIntNoAnnotation' from native "
"code, it must be annotated.");
EXPECT_ERROR(
Dart_GetStaticMethodClosure(lib, foo_cls, NewString("getIntCallOnly")),
"To closurize 'file:///test-lib::Foo.getIntCallOnly' from native "
"code, it must be annotated.");
}

TEST_CASE(DartAPI_ClassLibrary) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,15 @@ class A {
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
A() {
int f = "String";
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
int f = "String";
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
}
method(
[
int
g = "String"]) {
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
method([int g = "String"]) {
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
return g;
}
}
Expand Down
28 changes: 0 additions & 28 deletions tests/language/assign/static_type_runtime_test.dart

This file was deleted.

37 changes: 37 additions & 0 deletions tests/language/assign/to_type_error_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Verify that an attempt to assign to a class, enum, typedef, or type
// parameter produces a compile error.

class C<T> {
f() {
T = Null;
// [error column 5, length 1]
// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_TYPE
// [cfe] Can't assign to a type literal.
}
}

class D {}

enum E { e0 }

typedef void F();

main() {
new C<D>().f();
D = Null;
// [error column 3, length 1]
// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_TYPE
// [cfe] Can't assign to a type literal.
E = Null;
// [error column 3, length 1]
// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_TYPE
// [cfe] Can't assign to a type literal.
F = Null;
// [error column 3, length 1]
// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_TYPE
// [cfe] Can't assign to a type literal.
}
Loading

0 comments on commit 9a213cc

Please sign in to comment.