Skip to content

Commit

Permalink
Version 3.5.0-188.0.dev
Browse files Browse the repository at this point in the history
Merge a52acf1 into dev
  • Loading branch information
Dart CI committed May 24, 2024
2 parents 9d7324e + a52acf1 commit fef7786
Show file tree
Hide file tree
Showing 72 changed files with 1,010 additions and 1,791 deletions.
10 changes: 5 additions & 5 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -144,29 +144,29 @@ vars = {
#
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
"dart_style_rev": "a6ad7693555a9add6f98ad6fd94de80d35c89415", # disable tools/rev_sdk_deps.dart
"dartdoc_rev": "476d5cc872d45948fe682102595c3df6489b76a6",
"dartdoc_rev": "1e1a004c69022ae19e121b6b9c90039dccd56749",
"ecosystem_rev": "ad9da1557bbf522ff5bd25aa83117aeb818160c9",
"file_rev": "8ce0d13ffe9dac267bdbd6c65c145ba4f611af72",
"fixnum_rev": "ac892adead8317e22fafaec65a4e76bda1640f26",
"flute_rev": "a531c96a8b43d015c6bfbbfe3ab54867b0763b8b",
"glob_rev": "ee48ea82a1ccb64c8cc62e9f4f44c44ca67add71",
"html_rev": "00d34611eee5eff976bd12a631357a4d591ef5fb",
"http_rev": "5c01453ab467408194143d4106092201f03ed98e",
"http_rev": "7df2ac8488ec69ee5945ae188625c0e820c4f63c",
"http_multi_server_rev": "4a791af861da1cf53b57d9928fbc605f57139e4f",
"http_parser_rev": "702698a3fc726f7cbb8cd7824a8639c7fe84b169",
"intl_rev": "5d65e3808ce40e6282e40881492607df4e35669f",
"json_rpc_2_rev": "3187f7b59ed253d14b2560c5306b037bca6817b0",
"leak_tracker_rev": "f5620600a5ce1c44f65ddaa02001e200b096e14c", # manually rolled
"lints_rev": "b254c7e374b0328d4ebfe4f32638fd5e58a81b59",
"logging_rev": "49d89b1de6e847174bc93b709e858b99e61b2ae7",
"markdown_rev": "7463999481212e8708b7ab7ff8429b8f552ad30c",
"markdown_rev": "340c76f6cab697ca9a51e0772009347400d9488a",
"matcher_rev": "4ac4096facce24a781ab6609ca99995aeb443b25",
"material_color_utilities_rev": "799b6ba2f3f1c28c67cc7e0b4f18e0c7d7f3c03e",
"mime_rev": "b01c9a24e0991da479bd405138be3b3e403ff456",
"mockito_rev": "2302814df66e651b6710311366501523dbee2e11",
"native_rev": "fef40aebc3cf34654919e8a5785b6c50b3ea445c", # mosum@ and dacoharkes@ are rolling breaking changes manually while the assets features are in experimental.
"package_config_rev": "39096768806ccae4b7025dd4114f15f2df424b0c",
"path_rev": "9be79e72be7837fd8b99ae51a69f4c9f04ec29b4",
"path_rev": "aea50fa0e997e0401ea271783dddd364ce72f924",
"pool_rev": "1a6f2df19d7a24baaf674e032a0310a4f76725de",
"protobuf_rev": "ccf104dbc36929c0f8708285d5f3a8fae206343e",
"pub_rev": "e70850b53ef9b15a08af7fb0f0f2dcdbfa762b34", # disable tools/rev_sdk_deps.dart
Expand All @@ -190,7 +190,7 @@ vars = {
"typed_data_rev": "fb1958ca880d650972e124222d3d9e41bd35c76c",
"vector_math_rev": "43f2a77bb0be812b027a68a11792d563713b42a1",
"watcher_rev": "c182cd3db6f0bc285bf5da52df422f5c64f21a37",
"web_rev": "7604578eb538c471d438608673c037121d95dba5",
"web_rev": "d7766451f43001276b5493b2261d2973702b8334",
"web_socket_channel_rev": "45b8ce9ce9fb5194a24d3dff8913c573fbe7896a",
"webdev_rev": "fc32eb69f2ad666e9ab1cb3300510e5daed222d6",
"webdriver_rev": "f85779edd7c9f66198d4391ed3631db1d97a5b11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2556,8 +2556,6 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
if (pattern is ConstantPattern) {
if (pattern.expression case SimpleIdentifier identifier) {
if (!identifier.isSynthetic && offset < identifier.offset) {
state.request.opType.includeConstructorSuggestions = false;
state.request.opType.mustBeConst = true;
declarationHelper(
mustBeType: true,
).addLexicalDeclarations(node);
Expand All @@ -2570,8 +2568,6 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
// The user want a type for incomplete WildcardPattern.
if (pattern is WildcardPattern) {
if (offset < pattern.name.offset) {
state.request.opType.includeConstructorSuggestions = false;
state.request.opType.mustBeConst = true;
declarationHelper(
mustBeType: true,
).addLexicalDeclarations(node);
Expand Down Expand Up @@ -2599,17 +2595,14 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
switch (type.parent) {
case DeclaredVariablePattern():
//collector.completionLocation = 'DeclaredVariablePattern_type';
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
case ObjectPattern():
collector.completionLocation = 'ObjectPattern_type';
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
case WildcardPattern():
collector.completionLocation = 'WildcardPattern_type';
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
}
Expand Down Expand Up @@ -3351,8 +3344,6 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
if (pattern is ConstantPattern) {
if (pattern.expression case SimpleIdentifier identifier) {
if (!identifier.isSynthetic && offset < identifier.offset) {
state.request.opType.includeConstructorSuggestions = false;
state.request.opType.mustBeConst = true;
declarationHelper(
mustBeType: true,
).addLexicalDeclarations(node);
Expand All @@ -3364,8 +3355,6 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
// The user wants a type for incomplete WildcardPattern.
if (pattern is WildcardPattern) {
if (offset < pattern.name.offset) {
state.request.opType.includeConstructorSuggestions = false;
state.request.opType.mustBeConst = true;
declarationHelper(
mustBeType: true,
).addLexicalDeclarations(node);
Expand All @@ -3384,8 +3373,6 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
keywordHelper.addPatternKeywords();
// TODO(scheglov): Actually we need constructors, but only const.
// And not-yet imported contributors does not work well yet.
state.request.opType.includeConstructorSuggestions = false;
state.request.opType.mustBeConst = true;
declarationHelper(
mustBeNonVoid: true,
).addLexicalDeclarations(node);
Expand All @@ -3400,17 +3387,14 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
switch (type.parent) {
case DeclaredVariablePattern():
collector.completionLocation = 'DeclaredVariablePattern_type';
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
case ObjectPattern():
collector.completionLocation = 'ObjectPattern_type';
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
case WildcardPattern():
collector.completionLocation = 'WildcardPattern_type';
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
}
Expand Down
1 change: 1 addition & 0 deletions pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,7 @@ abstract class FileSystemEntity {
class IOSink implements Sink<List<int>> {
Future<dynamic> close() {}
void write(Object? object) {}
}
class Platform {
Expand Down
6 changes: 6 additions & 0 deletions pkg/analyzer/test/verify_diagnostics_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class DocumentationValidator {
// The code has been replaced but is not yet removed.
'HintCode.DEPRECATED_MEMBER_USE',

// Need a way to specify the existance of files whose content is irrelevant.
'LintCode.always_use_package_imports',
// Missing support for example files outside of `lib`.
'LintCode.avoid_relative_lib_imports',
// The example isn't being recognized as a flutter app. We might need to
Expand All @@ -116,8 +118,12 @@ class DocumentationValidator {
'LintCode.package_names',
// The lint does nothing.
'LintCode.package_prefixed_library_names',
// Need a way to specify the existance of files whose content is irrelevant.
'LintCode.prefer_relative_imports',
// Missing support for YAML files.
'LintCode.secure_pubspec_urls',
// The test framework doesn't yet support lints in non-dart files.
'LintCode.sort_pub_dependencies',
// Extra warning.
'LintCode.recursive_getters',

Expand Down
26 changes: 26 additions & 0 deletions pkg/compiler/lib/src/js_model/type_recipe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ abstract class TypeRecipeDomain {
TypeEnvironmentStructure environmentStructure2,
TypeRecipe recipe2,
);

/// Combines the binding (extension) of [recipe1] with [recipe2], where both
/// recipes are evaluated against the same environment with structure
/// [environmentStructure].
///
/// May return `null`.
TypeRecipeAndEnvironmentStructure? foldEvalBindEvalWithSharedEnvironment(
TypeEnvironmentStructure environmentStructure,
TypeRecipe recipe1,
TypeRecipe recipe2);
}

/// A type recipe and the structure of the type environment against which it is
Expand Down Expand Up @@ -479,6 +489,22 @@ class TypeRecipeDomainImpl implements TypeRecipeDomain {

return null;
}

@override
TypeRecipeAndEnvironmentStructure? foldEvalBindEvalWithSharedEnvironment(
TypeEnvironmentStructure environmentStructure,
TypeRecipe recipe1,
TypeRecipe recipe2) {
if (recipe1 is FullTypeEnvironmentRecipe &&
recipe2 is TypeExpressionRecipe) {
return TypeRecipeAndEnvironmentStructure(
FullTypeEnvironmentRecipe(
classType: recipe1.classType,
types: [...recipe1.types, recipe2.type]),
environmentStructure);
}
return null;
}
}

/// Substitution algorithm for transforming a TypeRecipe by substitution of
Expand Down
12 changes: 6 additions & 6 deletions pkg/compiler/lib/src/ssa/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault<void>
closedWorld.rtiNeed.classNeedsTypeArguments(cls);
if (needsTypeArguments) {
InterfaceType thisType = _elementEnvironment.getThisType(cls);
HInstruction typeArgument = _typeBuilder.analyzeTypeArgumentNewRti(
HInstruction typeArgument = _typeBuilder.analyzeTypeArgument(
thisType, sourceElement,
sourceInformation: sourceInformation);
constructorArguments.add(typeArgument);
Expand Down Expand Up @@ -1209,7 +1209,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault<void>
FunctionType functionType =
_elementMap.getFunctionType(originalClosureNode);
HInstruction rti =
_typeBuilder.analyzeTypeArgumentNewRti(functionType, sourceElement);
_typeBuilder.analyzeTypeArgument(functionType, sourceElement);
close(HReturn(
rti, _sourceInformationBuilder.buildReturn(originalClosureNode)))
.addSuccessor(graph.exit);
Expand Down Expand Up @@ -1551,7 +1551,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault<void>
if (elementType.containsFreeTypeVariables) {
// Type must be computed in the entry function, where the type variables
// are in scope, and passed to the body function.
inputs.add(_typeBuilder.analyzeTypeArgumentNewRti(elementType, function));
inputs.add(_typeBuilder.analyzeTypeArgument(elementType, function));
} else {
// Types with no type variables can be emitted as part of the generator,
// avoiding an extra argument.
Expand Down Expand Up @@ -3491,7 +3491,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault<void>
return object;
}
HInstruction rti =
_typeBuilder.analyzeTypeArgumentNewRti(arrayType, sourceElement);
_typeBuilder.analyzeTypeArgument(arrayType, sourceElement);

// TODO(15489): Register at codegen.
registry.registerInstantiation(type);
Expand Down Expand Up @@ -5998,7 +5998,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault<void>

void _checkTypeBound(HInstruction typeInstruction, DartType bound,
String variableName, String methodName) {
HInstruction boundInstruction = _typeBuilder.analyzeTypeArgumentNewRti(
HInstruction boundInstruction = _typeBuilder.analyzeTypeArgument(
localsHandler.substInContext(bound), sourceElement);

HInstruction variableNameInstruction =
Expand Down Expand Up @@ -6101,7 +6101,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault<void>
localsHandler.substInContext(_elementMap.getDartType(type));

HInstruction rti =
_typeBuilder.analyzeTypeArgumentNewRti(typeValue, sourceElement);
_typeBuilder.analyzeTypeArgument(typeValue, sourceElement);
AbstractValueWithPrecision checkedType =
_abstractValueDomain.createFromStaticType(typeValue, nullable: false);

Expand Down
25 changes: 23 additions & 2 deletions pkg/compiler/lib/src/ssa/optimize.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import '../js_backend/codegen_inputs.dart' show CodegenInputs;
import '../js_backend/native_data.dart' show NativeData;
import '../js_model/js_world.dart' show JClosedWorld;
import '../js_model/type_recipe.dart'
show TypeExpressionRecipe, TypeRecipeDomain, TypeRecipeDomainImpl;
show
TypeEnvironmentStructure,
TypeExpressionRecipe,
TypeRecipeDomain,
TypeRecipeDomainImpl;
import '../js_backend/specialized_checks.dart';
import '../native/behavior.dart';
import '../options.dart';
Expand Down Expand Up @@ -2158,7 +2162,24 @@ class SsaInstructionSimplifier extends HBaseVisitor<HInstruction>

@override
HInstruction visitTypeBind(HTypeBind node) {
// TODO(sra): env1.eval(X).bind(env1.eval(Y)) --> env1.eval(...X...Y...)
final environment = node.inputs[0];
final argument = node.inputs[1];
if (environment is HTypeEval &&
argument is HTypeEval &&
environment.inputs.single == argument.inputs.single &&
// Should always be true, but checking is safe:
TypeEnvironmentStructure.same(
environment.envStructure, argument.envStructure)) {
// env.eval(X).bind(env.eval(Y)) --> env.eval(...X...Y...)
final result = _typeRecipeDomain.foldEvalBindEvalWithSharedEnvironment(
environment.envStructure,
environment.typeExpression,
argument.typeExpression);
if (result != null) {
return HTypeEval(environment.inputs.single, result.environmentStructure,
result.recipe, node.instructionType);
}
}
return node;
}

Expand Down
10 changes: 1 addition & 9 deletions pkg/compiler/lib/src/ssa/type_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,6 @@ abstract class TypeBuilder {
HInstruction analyzeTypeArgument(
DartType argument, MemberEntity sourceElement,
{SourceInformation? sourceInformation}) {
return analyzeTypeArgumentNewRti(argument, sourceElement,
sourceInformation: sourceInformation);
}

HInstruction analyzeTypeArgumentNewRti(
DartType argument, MemberEntity sourceElement,
{SourceInformation? sourceInformation}) {
if (!argument.containsTypeVariables) {
HInstruction rti =
HLoadType.type(argument, _abstractValueDomain.dynamicType)
Expand Down Expand Up @@ -352,8 +345,7 @@ abstract class TypeBuilder {
if (_closedWorld.dartTypes.isTopType(type)) return original;
}

HInstruction reifiedType = analyzeTypeArgumentNewRti(
type, builder.sourceElement,
HInstruction reifiedType = analyzeTypeArgument(type, builder.sourceElement,
sourceInformation: sourceInformation);
AbstractValueWithPrecision checkedType =
_abstractValueDomain.createFromStaticType(type, nullable: true);
Expand Down
14 changes: 14 additions & 0 deletions pkg/compiler/lib/src/universe/class_hierarchy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,20 @@ class ClassHierarchyBuilder {
_commonElements, _classHierarchyNodes, _classSets);
}

/// Returns true if [cls] is not extended by any other class and is it not
/// used as a mixin.
bool hasNoSubclasses(ClassEntity cls) {
final classSet = _classSets[cls]!;
return classSet.node.directSubclasses.isEmpty &&
classSet.mixinApplicationNodes.isEmpty;
}

/// Returns true if [cls] is instantiated either directly, indirectly or
/// abstractly.
bool isInstantiated(ClassEntity cls) {
return _classHierarchyNodes[cls]!.isInstantiated;
}

void registerClass(ClassEntity cls) {
_ensureClassSet(cls);
}
Expand Down
Loading

0 comments on commit fef7786

Please sign in to comment.