Skip to content

Commit

Permalink
Version 3.4.0-79.0.dev
Browse files Browse the repository at this point in the history
Merge 6b0b4d4 into dev
  • Loading branch information
Dart CI committed Jan 26, 2024
2 parents 7337995 + 6b0b4d4 commit 58665e3
Show file tree
Hide file tree
Showing 102 changed files with 4,975 additions and 9,356 deletions.
11 changes: 4 additions & 7 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ vars = {
# Checked-in SDK version. The checked-in SDK is a Dart SDK distribution
# in a cipd package used to run Dart scripts in the build and test
# infrastructure, which is automatically built on the release commits.
"sdk_tag": "version:3.2.4",
"sdk_tag": "version:3.3.0-279.1.beta",

# co19 is a cipd package automatically generated for each co19 commit.
# Use tests/co19/update.sh to update this hash.
"co19_rev": "dadc1781676fe5562917ac6bc5ea38da64abe76a",
"co19_rev": "af2ac968c0ca28b7dd94325b00a3acf569f6e858",

# The internal benchmarks to use. See go/dart-benchmarks-internal
"benchmarks_internal_rev": "3e58fcfa1464ffd7b1d3edc7a8d5d9a24a321c5d",
Expand Down Expand Up @@ -141,9 +141,8 @@ vars = {
#
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
"dart_style_rev": "8b1f24a8475a0116757172cd9acca4acbf87d973", # disable rev_sdk_deps.dart
"dartdoc_rev": "49d48d7749f48e2d9930ffda5bcde1e692ffce31",
"dartdoc_rev": "0f13e6443595f8e49cc86d783210d78c93d3502e",
"ecosystem_rev": "1e2785d6900b4d709a31f4c669381dc340cad605",
"ffi_rev": "c926657618443ff4821411ede01684096b503f84",
"file_rev": "cd3a9324f6483f313ba1f0f3ff382ea4e6982ef2",
"fixnum_rev": "3e08c0d7ce1a0cd832a17391444898ec610b5f89",
"flute_rev": "f42b09f77132210499ec8ed819a60c260af03db6",
Expand All @@ -162,7 +161,7 @@ vars = {
"material_color_utilities_rev": "799b6ba2f3f1c28c67cc7e0b4f18e0c7d7f3c03e",
"mime_rev": "ca9f059d2334bb2657683e0a7f5949817cb4b0e6",
"mockito_rev": "e15e00086ed20f3175b2e677fd11611be4fa8e8e",
"native_rev": "153811080d9020c894c4e820053d2ede79ca9012",
"native_rev": "40382efb9c7a0774d2764238fc1802e562e9cbaf",
"package_config_rev": "33dd24659147bd7ed2fa87aeacc52d199be766b4",
"path_rev": "57a049cff2e2be7a302dd9683b2b194c6d06e2d4",
"pool_rev": "4c490001446d8ba3d361b99d8befd6a4f61abc7a",
Expand Down Expand Up @@ -385,8 +384,6 @@ deps = {
Var("dart_git") + "dartdoc.git" + "@" + Var("dartdoc_rev"),
Var("dart_root") + "/third_party/pkg/ecosystem":
Var("dart_git") + "ecosystem.git" + "@" + Var("ecosystem_rev"),
Var("dart_root") + "/third_party/pkg/ffi":
Var("dart_git") + "ffi.git" + "@" + Var("ffi_rev"),
Var("dart_root") + "/third_party/pkg/fixnum":
Var("dart_git") + "fixnum.git" + "@" + Var("fixnum_rev"),
Var("dart_root") + "/third_party/flute": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class BulkFixProcessor {
CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE: [
DataDriven.new,
],
CompileTimeErrorCode.CAST_TO_NON_TYPE: [
DataDriven.new,
],
CompileTimeErrorCode.EXTENDS_NON_CLASS: [
DataDriven.new,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1518,8 +1518,6 @@ CompileTimeErrorCode.SUPER_INVOCATION_NOT_LAST:
status: hasFix
CompileTimeErrorCode.SWITCH_CASE_COMPLETES_NORMALLY:
status: hasFix
CompileTimeErrorCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE:
status: noFix
CompileTimeErrorCode.TEAROFF_OF_GENERATIVE_CONSTRUCTOR_OF_ABSTRACT_CLASS:
status: noFix
since: 2.15
Expand Down Expand Up @@ -1765,14 +1763,6 @@ FfiCode.FFI_NATIVE_INVALID_DUPLICATE_DEFAULT_ASSET:
status: needsEvaluation
FfiCode.FFI_NATIVE_INVALID_MULTIPLE_ANNOTATIONS:
status: needsEvaluation
FfiCode.FIELD_IN_STRUCT_WITH_INITIALIZER:
status: needsFix
notes: |-
The fix is to remove the initializer and add the `external` modifier.
FfiCode.FIELD_INITIALIZER_IN_STRUCT:
status: needsFix
notes: |-
The fix is to remove the initializer and add the `external` modifier.
FfiCode.FIELD_MUST_BE_EXTERNAL_IN_STRUCT:
status: needsFix
since: ~2.15
Expand Down Expand Up @@ -3714,8 +3704,6 @@ WarningCode.MISSING_REQUIRED_PARAM:
status: hasFix
WarningCode.MISSING_REQUIRED_PARAM_WITH_DETAILS:
status: hasFix
WarningCode.MISSING_RETURN:
status: noFix
WarningCode.MIXIN_ON_SEALED_CLASS:
status: noFix
notes: |-
Expand Down Expand Up @@ -3782,9 +3770,6 @@ WarningCode.SDK_VERSION_CONSTRUCTOR_TEAROFFS:
since: 2.15
WarningCode.SDK_VERSION_GT_GT_GT_OPERATOR:
status: hasFix
WarningCode.SDK_VERSION_NEVER:
status: noFix
notes: Deprecated
WarningCode.SDK_VERSION_SINCE:
status: needsFix
notes: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ final _builtInNonLintMultiProducers = {
DataDriven.new,
],
CompileTimeErrorCode.CAST_TO_NON_TYPE: [
DataDriven.new,
ImportLibrary.forType,
],
CompileTimeErrorCode.CONST_WITH_NON_TYPE: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,52 @@ class RenameClassTest extends _AbstractRenameTest {
@override
String get _kind => 'class';

Future<void> test_as_deprecated() async {
setPackageContent('''
class A {}
@deprecated
class Old extends A {}
class New extends A {}
''');
setPackageData(_rename(['Old'], 'New'));
await resolveTestCode('''
import '$importUri';
void f(A o) {
print(o as Old);
}
''');
await assertHasFix('''
import '$importUri';
void f(A o) {
print(o as New);
}
''');
}

Future<void> test_as_removed() async {
setPackageContent('''
class A {}
class New extends A {}
''');
setPackageData(_rename(['Old'], 'New'));
await resolveTestCode('''
import '$importUri';
void f(A o) {
print(o as Old);
}
''');
await assertHasFix('''
import '$importUri';
void f(A o) {
print(o as New);
}
''');
}

Future<void> test_constructor_named_deprecated() async {
setPackageContent('''
@deprecated
Expand Down
35 changes: 23 additions & 12 deletions pkg/analyzer/lib/src/dart/analysis/file_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1838,25 +1838,33 @@ $code
final macroRelativeUri = uriCache.parse(macroFileName);
final macroUri = uriCache.resolveRelative(file.uri, macroRelativeUri);

// Normally this should not happen.
// But it happens, when LSP asks for the file while we linking.
if (file._fsState._uriToFile[macroUri] case var existing?) {
_disposeMacroFile(existing);
}

final contentBytes = utf8.encoder.convert(augmentationContent);
final hashBytes = md5.convert(contentBytes).bytes;
final hashStr = hex.encode(hashBytes);
file._fsState._macroFileContent = StoredFileContent(
final fileContent = StoredFileContent(
content: augmentationContent,
contentHash: hashStr,
exists: true,
);

// This content will be consumed by the next `refresh()`.
// This might happen during `getFileForUri()` below.
// Or this happens during the explicit `refresh()`, more below.
file._fsState._macroFileContent = fileContent;

final macroFileResolution = file._fsState.getFileForUri(macroUri);
macroFileResolution as UriResolutionFile;
final macroFile = macroFileResolution.file;

// If the file existed, and has different content, force `refresh()`.
// This will ensure that the file has the required content.
if (macroFile.content != fileContent.content) {
macroFile.refresh();
}

// We are done with the file, stop forcing its content.
file._fsState._macroFileContent = null;

final import = AugmentationImportWithFile(
container: this,
unlinked: UnlinkedAugmentationImportDirective(
Expand Down Expand Up @@ -1906,12 +1914,14 @@ $code
/// macros might potentially generate different code, or no code at all. So,
/// we discard the existing macro augmentation library, it will be rebuilt
/// during linking.
void disposeMacroAugmentations() {
void disposeMacroAugmentations({
required bool disposeFiles,
}) {
for (final macroImport in _macroImports) {
_augmentationImports = augmentationImports.withoutLast.toFixedList();
// Discard the file.
final macroFile = macroImport.importedFile;
_disposeMacroFile(macroFile);
if (disposeFiles) {
_disposeMacroFile(macroImport.importedFile);
}
}
_macroImports = const [];
}
Expand All @@ -1929,7 +1939,8 @@ $code

void internal_setLibraryCycle(LibraryCycle? cycle) {
_libraryCycle = cycle;
disposeMacroAugmentations();
// Keep the merged augmentation file, as we do for normal files.
disposeMacroAugmentations(disposeFiles: false);
}

@override
Expand Down
13 changes: 0 additions & 13 deletions pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

import 'package:analyzer/dart/analysis/declared_variables.dart';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
Expand Down Expand Up @@ -48,7 +47,6 @@ import 'package:analyzer/src/ignore_comments/ignore_info.dart';
import 'package:analyzer/src/lint/linter.dart';
import 'package:analyzer/src/lint/linter_visitor.dart';
import 'package:analyzer/src/services/lint.dart';
import 'package:analyzer/src/task/strong/checker.dart';
import 'package:analyzer/src/util/performance/operation_performance.dart';
import 'package:analyzer/src/utilities/extensions/version.dart';
import 'package:analyzer/src/workspace/pub.dart';
Expand Down Expand Up @@ -387,16 +385,6 @@ class LibraryAnalyzer {
void _computeVerifyErrors(FileState file, CompilationUnit unit) {
ErrorReporter errorReporter = _getErrorReporter(file);

if (!unit.featureSet.isEnabled(Feature.non_nullable)) {
CodeChecker checker = CodeChecker(
_typeProvider,
_typeSystem,
errorReporter,
strictCasts: _analysisOptions.strictCasts,
);
checker.visitCompilationUnit(unit);
}

//
// Use the ConstantVerifier to compute errors.
//
Expand Down Expand Up @@ -506,7 +494,6 @@ class LibraryAnalyzer {
SdkConstraintVerifier verifier = SdkConstraintVerifier(
errorReporter,
_libraryElement,
_typeProvider,
sdkVersionConstraint.withoutPreRelease,
);
unit.accept(verifier);
Expand Down
59 changes: 1 addition & 58 deletions pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,8 @@ class ConstantVerifier extends RecursiveAstVisitor<void> {
_typeSystem.isAlwaysExhaustive(node.expression.typeOrThrow),
isSwitchExpression: false,
);
} else if (_currentLibrary.isNonNullableByDefault) {
_validateSwitchStatement_nullSafety(node);
} else {
_validateSwitchStatement_legacy(node);
_validateSwitchStatement_nullSafety(node);
}
});
}
Expand Down Expand Up @@ -974,61 +972,6 @@ class ConstantVerifier extends RecursiveAstVisitor<void> {
}
}

void _validateSwitchStatement_legacy(SwitchStatement node) {
// TODO(paulberry): to minimize error messages, it would be nice to
// compare all types with the most popular type rather than the first
// type.
bool foundError = false;
DartObjectImpl? firstValue;
DartType? firstType;
for (var switchMember in node.members) {
if (switchMember is SwitchCase) {
Expression expression = switchMember.expression;

var expressionValue = _evaluateAndReportError(
expression,
CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION,
);
if (expressionValue is! DartObjectImpl) {
continue;
}
firstValue ??= expressionValue;

var expressionValueType = _typeSystem.toLegacyTypeIfOptOut(
expressionValue.type,
);

if (firstType == null) {
firstType = expressionValueType;
} else {
if (firstType != expressionValueType) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES,
expression,
[expression.toSource(), firstType],
);
foundError = true;
}
}
}
}

if (foundError) {
return;
}

if (firstValue != null) {
final featureSet = _currentLibrary.featureSet;
if (!firstValue.hasPrimitiveEquality(featureSet)) {
_errorReporter.reportErrorForToken(
CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS,
node.switchKeyword,
[firstValue.type],
);
}
}
}

void _validateSwitchStatement_nullSafety(SwitchStatement node) {
void validateExpression(Expression expression) {
var expressionValue = _evaluateAndReportError(
Expand Down
19 changes: 0 additions & 19 deletions pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,25 +208,6 @@ class FfiCode extends AnalyzerErrorCode {
"first parameter for the receiver.",
);

/// No parameters.
static const FfiCode FIELD_INITIALIZER_IN_STRUCT = FfiCode(
'FIELD_INITIALIZER_IN_STRUCT',
"Constructors in subclasses of 'Struct' and 'Union' can't have field "
"initializers.",
correctionMessage:
"Try removing the field initializer and marking the field as external.",
hasPublishedDocs: true,
);

/// No parameters.
static const FfiCode FIELD_IN_STRUCT_WITH_INITIALIZER = FfiCode(
'FIELD_IN_STRUCT_WITH_INITIALIZER',
"Fields in subclasses of 'Struct' and 'Union' can't have initializers.",
correctionMessage:
"Try removing the initializer and marking the field as external.",
hasPublishedDocs: true,
);

/// No parameters.
static const FfiCode FIELD_MUST_BE_EXTERNAL_IN_STRUCT = FfiCode(
'FIELD_MUST_BE_EXTERNAL_IN_STRUCT',
Expand Down
Loading

0 comments on commit 58665e3

Please sign in to comment.