Skip to content

Commit

Permalink
Version 3.6.0-303.0.dev
Browse files Browse the repository at this point in the history
Merge 01c82f8 into dev
  • Loading branch information
Dart CI committed Sep 30, 2024
2 parents d9fb41a + 01c82f8 commit 90859ec
Show file tree
Hide file tree
Showing 62 changed files with 787 additions and 325 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ class GenericInferenceState<TypeParameter extends Object> extends State {
abstract interface class SharedInferenceLogWriter<
TypeStructure extends SharedTypeStructure<TypeStructure>,
Type extends SharedTypeStructure<Type>,
TypeParameter extends Object> {
TypeParameterStructure extends SharedTypeParameterStructure<
TypeStructure>> {
/// If [inProgress] is `true`, verifies that generic type inference is in
/// progress; otherwise, verifies that generic type inference is not in
/// progress.
Expand Down Expand Up @@ -170,7 +171,8 @@ abstract interface class SharedInferenceLogWriter<
void enterFunctionExpressionInvocationTarget(Object node);

/// Called when generic type inference begins.
void enterGenericInference(List<TypeParameter> typeFormals, Type template);
void enterGenericInference(
List<TypeParameterStructure> typeFormals, Type template);

/// Called when type inference begins inferring the left hand side of an
/// assignment.
Expand Down Expand Up @@ -239,8 +241,9 @@ abstract interface class SharedInferenceLogWriter<
/// Records a constraint that was generated during the process of matching one
/// type schema to another.
void recordGeneratedConstraint(
TypeParameter parameter,
MergedTypeConstraint<TypeStructure, TypeParameter, Object, Type, Object>
TypeParameterStructure parameter,
MergedTypeConstraint<TypeStructure, TypeParameterStructure, Object, Type,
Object>
constraint);

/// Records that type inference has resolved a method name.
Expand Down Expand Up @@ -271,8 +274,10 @@ abstract interface class SharedInferenceLogWriter<
abstract class SharedInferenceLogWriterImpl<
TypeStructure extends SharedTypeStructure<TypeStructure>,
Type extends SharedTypeStructure<Type>,
TypeParameter extends Object>
implements SharedInferenceLogWriter<TypeStructure, Type, TypeParameter> {
TypeParameterStructure extends SharedTypeParameterStructure<
TypeStructure>>
implements
SharedInferenceLogWriter<TypeStructure, Type, TypeParameterStructure> {
/// A stack of [State] objects representing the calls that have been made to
/// `enter...` methods without any matched `exit...` method.
///
Expand Down Expand Up @@ -450,13 +455,14 @@ abstract class SharedInferenceLogWriterImpl<
}

@override
void enterGenericInference(List<TypeParameter> typeFormals, Type template) {
void enterGenericInference(
List<TypeParameterStructure> typeFormals, Type template) {
if (state.kind == StateKind.genericInference) {
fail('Tried to start generic inference when already in progress');
}
String typeFormalNames = [
for (TypeParameter typeFormal in typeFormals)
getTypeParameterName(typeFormal)
for (TypeParameterStructure typeFormal in typeFormals)
typeFormal.displayName
].join(', ');
pushState(new GenericInferenceState(
writer: this,
Expand Down Expand Up @@ -628,12 +634,6 @@ abstract class SharedInferenceLogWriterImpl<
throw new StateError(message);
}

/// Gets the name of [typeParameter].
///
/// This is required since there is no common base class for type parameters
/// that is shared by the analyzer and CFE.
String getTypeParameterName(TypeParameter typeParameter);

/// Pops the most recently pushed [State] from [_stateStack].
void popState() {
if (_stateStack.length == 1) {
Expand Down Expand Up @@ -688,8 +688,9 @@ abstract class SharedInferenceLogWriterImpl<

@override
void recordGeneratedConstraint(
TypeParameter parameter,
MergedTypeConstraint<TypeStructure, TypeParameter, Object, Type, Object>
TypeParameterStructure parameter,
MergedTypeConstraint<TypeStructure, TypeParameterStructure, Object, Type,
Object>
constraint) {
checkCall(
method: 'recordGeneratedConstraint',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ mixin TypeAnalyzer<
Variable extends Object,
Pattern extends Node,
Error,
InferableParameter extends Object,
TypeParameterStructure extends SharedTypeParameterStructure<TypeStructure>,
TypeDeclarationType extends Object,
TypeDeclaration extends Object> {
TypeAnalyzerErrors<Node, Statement, Expression, Variable,
Expand All @@ -281,7 +281,7 @@ mixin TypeAnalyzer<

/// The [TypeAnalyzerOperations], used to access types, check subtyping, and
/// query variable types.
TypeAnalyzerOperations<TypeStructure, Variable, InferableParameter,
TypeAnalyzerOperations<TypeStructure, Variable, TypeParameterStructure,
TypeDeclarationType, TypeDeclaration> get operations;

/// Options affecting the behavior of [TypeAnalyzer].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import 'nullability_suffix.dart';
abstract interface class TypeAnalyzerOperations<
TypeStructure extends SharedTypeStructure<TypeStructure>,
Variable extends Object,
InferableParameter extends Object,
// Work around https://github.com/dart-lang/dart_style/issues/1568
// ignore: lines_longer_than_80_chars
TypeParameterStructure extends SharedTypeParameterStructure<TypeStructure>,
TypeDeclarationType extends Object,
TypeDeclaration extends Object>
implements FlowAnalysisOperations<Variable, SharedTypeView<TypeStructure>> {
Expand Down Expand Up @@ -440,7 +442,7 @@ abstract interface class TypeAnalyzerOperations<
/// `foo`.
///
/// X foo<X>(bool c, X x1, X x2) => c ? x1 : x2;
InferableParameter? matchInferableParameter(
TypeParameterStructure? matchInferableParameter(
SharedTypeView<TypeStructure> type);

/// If [type] is a subtype of the type `Iterable<T>?` for some `T`, returns
Expand Down Expand Up @@ -671,11 +673,13 @@ abstract interface class TypeAnalyzerOperations<
mixin TypeAnalyzerOperationsMixin<
TypeStructure extends SharedTypeStructure<TypeStructure>,
Variable extends Object,
InferableParameter extends Object,
// Work around https://github.com/dart-lang/dart_style/issues/1568
// ignore: lines_longer_than_80_chars
TypeParameterStructure extends SharedTypeParameterStructure<TypeStructure>,
TypeDeclarationType extends Object,
TypeDeclaration extends Object>
implements
TypeAnalyzerOperations<TypeStructure, Variable, InferableParameter,
TypeAnalyzerOperations<TypeStructure, Variable, TypeParameterStructure,
TypeDeclarationType, TypeDeclaration> {
@override
SharedTypeView<TypeStructure> futureType(
Expand Down Expand Up @@ -865,7 +869,7 @@ mixin TypeAnalyzerOperationsMixin<
abstract class TypeConstraintGenerator<
TypeStructure extends SharedTypeStructure<TypeStructure>,
Variable extends Object,
InferableParameter extends Object,
TypeParameterStructure extends SharedTypeParameterStructure<TypeStructure>,
TypeDeclarationType extends Object,
TypeDeclaration extends Object,
AstNode extends Object> {
Expand All @@ -886,7 +890,7 @@ abstract class TypeConstraintGenerator<
bool get enableDiscrepantObliviousnessOfNullabilitySuffixOfFutureOr;

/// Abstract type operations to be used in the matching methods.
TypeAnalyzerOperations<TypeStructure, Variable, InferableParameter,
TypeAnalyzerOperations<TypeStructure, Variable, TypeParameterStructure,
TypeDeclarationType, TypeDeclaration> get typeAnalyzerOperations;

/// Returns the type arguments of the supertype of [type] that is an
Expand Down Expand Up @@ -1160,11 +1164,13 @@ abstract class TypeConstraintGenerator<
mixin TypeConstraintGeneratorMixin<
TypeStructure extends SharedTypeStructure<TypeStructure>,
Variable extends Object,
InferableParameter extends Object,
// Work around https://github.com/dart-lang/dart_style/issues/1568
// ignore: lines_longer_than_80_chars
TypeParameterStructure extends SharedTypeParameterStructure<TypeStructure>,
TypeDeclarationType extends Object,
TypeDeclaration extends Object,
AstNode extends Object>
on TypeConstraintGenerator<TypeStructure, Variable, InferableParameter,
on TypeConstraintGenerator<TypeStructure, Variable, TypeParameterStructure,
TypeDeclarationType, TypeDeclaration, AstNode> {
@override
bool performSubtypeConstraintGenerationLeftSchema(
Expand Down
Loading

0 comments on commit 90859ec

Please sign in to comment.