Skip to content

Commit

Permalink
Version 3.5.0-239.0.dev
Browse files Browse the repository at this point in the history
Merge 07d2288 into dev
  • Loading branch information
Dart CI committed Jun 8, 2024
2 parents d4f17e0 + 07d2288 commit 48c6249
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DiagnosticServerHandler
Method get handlesMessage => CustomMethods.diagnosticServer;

@override
LspJsonHandler<void> get jsonHandler => NullJsonHandler;
LspJsonHandler<void> get jsonHandler => nullJsonHandler;

@override
Future<ErrorOr<DartDiagnosticServer>> handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ReanalyzeHandler extends LspMessageHandler<void, void> {
Method get handlesMessage => CustomMethods.reanalyze;

@override
LspJsonHandler<void> get jsonHandler => NullJsonHandler;
LspJsonHandler<void> get jsonHandler => nullJsonHandler;

@override
Future<ErrorOr<void>> handle(
Expand Down
2 changes: 1 addition & 1 deletion pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ExitMessageHandler extends LspMessageHandler<void, void> {
Method get handlesMessage => Method.exit;

@override
LspJsonHandler<void> get jsonHandler => NullJsonHandler;
LspJsonHandler<void> get jsonHandler => nullJsonHandler;

@override
Future<ErrorOr<void>> handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RejectMessageHandler extends SharedMessageHandler<Object?, void> {
super.server, this.handlesMessage, this.errorCode, this.errorMessage);

@override
LspJsonHandler<void> get jsonHandler => NullJsonHandler;
LspJsonHandler<void> get jsonHandler => nullJsonHandler;

@override
ErrorOr<void> handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ShutdownMessageHandler extends LspMessageHandler<void, void> {
Method get handlesMessage => Method.shutdown;

@override
LspJsonHandler<void> get jsonHandler => NullJsonHandler;
LspJsonHandler<void> get jsonHandler => nullJsonHandler;

@override
ErrorOr<void> handle(
Expand Down
2 changes: 2 additions & 0 deletions pkg/analysis_server/tool/lsp_spec/generate_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ $licenseComment
// To regenerate the file, use the script
// "pkg/analysis_server/tool/lsp_spec/generate_all.dart".
// ignore_for_file: constant_identifier_names
import 'dart:convert' show JsonEncoder;
import 'package:collection/collection.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright (c) 2024, 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.

// Tests that we still need default values for `this._` and `super._` and that
// we can't add default values to a `_` named parameter where you can't add
// default values.

// SharedOptions=--enable-experiment=wildcard-variables

class SuperClass {
SuperClass([int _]);
// ^
// [analyzer] COMPILE_TIME_ERROR.MISSING_DEFAULT_VALUE_FOR_PARAMETER
// [cfe] The parameter '_' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
SuperClass.nullable([int? _]);
}
class SubClass extends SuperClass {
final int _;
SubClass([
this._,
// ^
// [analyzer] COMPILE_TIME_ERROR.MISSING_DEFAULT_VALUE_FOR_PARAMETER
// [cfe] The parameter '_' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
super._,
// ^
// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION
// [analyzer] COMPILE_TIME_ERROR.MISSING_DEFAULT_VALUE_FOR_PARAMETER
// [cfe] Duplicated parameter name '_'.
// [cfe] The parameter '_' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// [cfe] Type 'int' of the optional super-initializer parameter '_' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
]);
}
class TypedSubClass extends SuperClass {
final int? _;
TypedSubClass([
int this._,
// ^
// [analyzer] COMPILE_TIME_ERROR.MISSING_DEFAULT_VALUE_FOR_PARAMETER
// [cfe] The parameter '_' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
int super._,
// ^
// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION
// [analyzer] COMPILE_TIME_ERROR.MISSING_DEFAULT_VALUE_FOR_PARAMETER
// [cfe] Duplicated parameter name '_'.
// [cfe] The parameter '_' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// [cfe] Type 'int' of the optional super-initializer parameter '_' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
]) : super.nullable();
}

// Function type parameters cannot have default values.
typedef F = void Function([int _ = 1]);
// ^
// [analyzer] SYNTACTIC_ERROR.DEFAULT_VALUE_IN_FUNCTION_TYPE
// [cfe] Can't have a default value in a function type.

// Redirecting factory constructors cannot have default values.
class ReClass {
ReClass([int x = 0]);
factory ReClass.redir([int _ = 0]) = ReClass;
// ^
// [analyzer] COMPILE_TIME_ERROR.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR
// ^
// [cfe] Can't have a default value here because any default values of 'ReClass' would be used instead.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright (c) 2024, 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.

// Unnamed optional parameters, which are not initializing or super parameters,
// that have no default values, have no errors.

// SharedOptions=--enable-experiment=wildcard-variables

import 'package:expect/expect.dart';

class C {
C([int _]) {}
C.otherParams([int _, bool x = false, bool _ = true]) {}
C.otherParams2([int _ = 1, bool x = false, bool _]) {}

int foo([int _]) => 1;
int foo2([bool x = false, bool _, int _]) => 1;
int foo3([bool? x, bool _ = false, int _]) => 1;
int foo4([int _, bool? x, bool _ = false]) => 1;

static int fn([int _]) => 1;
static int fn2([bool x = false, bool _, int _]) => 1;
static int fn3([bool? x, bool _ = false, int _]) => 1;
static int fn4([int _, bool? x, bool _ = false]) => 1;
}

int _([bool _]) => 1;
int topFoo2([bool x = false, bool _, int _]) => 1;
int topFoo3([bool? x, bool _ = false, int _]) => 1;
int topFoo4([int _, bool? x, bool _ = false]) => 1;

void main() {
Expect.equals(1, _());
Expect.equals(1, topFoo2());
Expect.equals(1, topFoo3());
Expect.equals(1, topFoo4());

int foo([int _]) => 1;
int foo2([bool x = false, bool _, int _]) => 1;
int foo3([bool? x, bool _ = false, int _]) => 1;
int foo4([int _, bool? x, bool _ = false]) => 1;
Expect.equals(1, foo());
Expect.equals(1, foo2());
Expect.equals(1, foo3());
Expect.equals(1, foo4());

var c = C();
Expect.equals(1, c.foo());
Expect.equals(1, c.foo2());
Expect.equals(1, c.foo3());
Expect.equals(1, c.foo4());

Expect.equals(1, C.otherParams().foo());
Expect.equals(1, C.otherParams2().foo());

Expect.equals(1, C.fn());
Expect.equals(1, C.fn2());
Expect.equals(1, C.fn3());
Expect.equals(1, C.fn4());
}
1 change: 1 addition & 0 deletions third_party/pkg/dap/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ dev_dependencies:
args: any
collection: any
http: any
lints: any
path: any
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
// To regenerate the file, use the script
// "pkg/analysis_server/tool/lsp_spec/generate_all.dart".

// ignore_for_file: constant_identifier_names

import 'dart:convert' show JsonEncoder;

import 'package:collection/collection.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
// To regenerate the file, use the script
// "pkg/analysis_server/tool/lsp_spec/generate_all.dart".

// ignore_for_file: constant_identifier_names

import 'dart:convert' show JsonEncoder;

import 'package:collection/collection.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:language_server_protocol/protocol_generated.dart';

const jsonRpcVersion = '2.0';

const NullJsonHandler = LspJsonHandler<void>(_alwaysTrue, _alwaysNull);
const nullJsonHandler = LspJsonHandler<void>(_alwaysTrue, _alwaysNull);

/// Returns if two objects are equal, recursively checking items in
/// Maps/Lists.
Expand Down
11 changes: 6 additions & 5 deletions third_party/pkg/language_server_protocol/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: language_server_protocol
version: 0.0.0
description: >-
A Dart implementation of the language server protocol.
repository: https://github.com/dart-lang/sdk/tree/main/third_party/pkg/language_server_protocol

publish_to: none

environment:
sdk: '>=3.0.0 <4.0.0'

# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
collection: 'any'
collection: any

dependency_overrides:
collection:
path: ../collection
# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
lints: any
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 5
PATCH 0
PRERELEASE 238
PRERELEASE 239
PRERELEASE_PATCH 0
11 changes: 11 additions & 0 deletions tools/bots/test_matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -2958,6 +2958,17 @@
"pkg/pkg/dartdev/test/native_assets"
]
},
{
"name": "analyze third_party/pkg authored packages",
"script": "${build_root}/dart-sdk/bin/dart",
"arguments": [
"analyze",
"--suppress-analytics",
"--fatal-infos",
"third_party/pkg/dap",
"third_party/pkg/language_server_protocol"
]
},
{
"name": "pub integration tests",
"script": "tools/bots/pub_integration_test.py",
Expand Down

0 comments on commit 48c6249

Please sign in to comment.