-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge afcfe1e into dev
- Loading branch information
Showing
1,195 changed files
with
26,948 additions
and
19,728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
## 3.8.0 | ||
|
||
## 3.7.0 | ||
|
||
### Language | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ [email protected] #{LAST_RESORT_SUGGESTION} | |
|
||
# DEPS | ||
per-file DEPS=file:/tools/OWNERS_ENG | ||
# Updates fuchsia components only. | ||
per-file DEPS=file:/tools/OWNERS_FUCHSIA | ||
|
||
# Changelog, AUTHORS, and .git* do not require approval. | ||
per-file CHANGELOG.md,AUTHORS,WATCHLISTS,.gitattributes,.gitconfig,.gitignore,sdk.code-workspace=* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
pkg/_fe_analyzer_shared/test/mini_type_constraint_gatherer.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
// Copyright (c) 2025, 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. | ||
|
||
import 'package:_fe_analyzer_shared/src/type_inference/type_analyzer_operations.dart'; | ||
import 'package:_fe_analyzer_shared/src/type_inference/type_constraint.dart'; | ||
import 'package:_fe_analyzer_shared/src/types/shared_type.dart'; | ||
|
||
import 'mini_ast.dart'; | ||
import 'mini_types.dart'; | ||
|
||
class TypeConstraintGatherer extends TypeConstraintGenerator<Type, | ||
NamedFunctionParameter, Var, TypeParameter, Type, String, Node> | ||
with | ||
TypeConstraintGeneratorMixin<Type, NamedFunctionParameter, Var, | ||
TypeParameter, Type, String, Node> { | ||
@override | ||
final Set<TypeParameter> typeParametersToConstrain = <TypeParameter>{}; | ||
|
||
@override | ||
final bool enableDiscrepantObliviousnessOfNullabilitySuffixOfFutureOr; | ||
|
||
@override | ||
final MiniAstOperations typeAnalyzerOperations = MiniAstOperations(); | ||
|
||
final constraints = <String>[]; | ||
|
||
TypeConstraintGatherer(Set<String> typeVariablesBeingConstrained, | ||
{this.enableDiscrepantObliviousnessOfNullabilitySuffixOfFutureOr = false}) | ||
: super(inferenceUsingBoundsIsEnabled: false) { | ||
for (var typeVariableName in typeVariablesBeingConstrained) { | ||
typeParametersToConstrain | ||
.add(TypeRegistry.addTypeParameter(typeVariableName)); | ||
} | ||
} | ||
|
||
@override | ||
TypeConstraintGeneratorState get currentState => | ||
TypeConstraintGeneratorState(constraints.length); | ||
|
||
@override | ||
void addLowerConstraintForParameter(TypeParameter typeParameter, Type lower, | ||
{required Node? astNodeForTesting}) { | ||
constraints.add('$lower <: $typeParameter'); | ||
} | ||
|
||
@override | ||
void addUpperConstraintForParameter(TypeParameter typeParameter, Type upper, | ||
{required Node? astNodeForTesting}) { | ||
constraints.add('$typeParameter <: $upper'); | ||
} | ||
|
||
@override | ||
Map<TypeParameter, | ||
MergedTypeConstraint<Type, TypeParameter, Var, Type, String>> | ||
computeConstraints() { | ||
// TODO(cstefantsova): implement computeConstraints | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
void eliminateTypeParametersInGeneratedConstraints( | ||
Object eliminator, TypeConstraintGeneratorState eliminationStartState, | ||
{required Node? astNodeForTesting}) { | ||
// TODO(paulberry): implement eliminateTypeParametersInGeneratedConstraints | ||
} | ||
|
||
@override | ||
List<Type>? getTypeArgumentsAsInstanceOf(Type type, String typeDeclaration) { | ||
// We just have a few cases hardcoded here to make the tests work. | ||
// TODO(paulberry): if this gets too unwieldy, replace it with a more | ||
// general implementation. | ||
switch ((type, typeDeclaration)) { | ||
case (PrimaryType(name: 'List', :var args), 'Iterable'): | ||
// List<T> inherits from Iterable<T> | ||
return args; | ||
case (PrimaryType(name: 'MyListOfInt'), 'List'): | ||
// MyListOfInt inherits from List<int> | ||
return [Type('int')]; | ||
case (PrimaryType(name: 'Future'), 'int'): | ||
case (PrimaryType(name: 'int'), 'String'): | ||
case (PrimaryType(name: 'List'), 'Future'): | ||
case (PrimaryType(name: 'String'), 'int'): | ||
case (PrimaryType(name: 'Future'), 'String'): | ||
// Unrelated types | ||
return null; | ||
default: | ||
throw UnimplementedError( | ||
'getTypeArgumentsAsInstanceOf($type, $typeDeclaration)'); | ||
} | ||
} | ||
|
||
@override | ||
( | ||
Type, | ||
Type, { | ||
List<TypeParameter> typeParametersToEliminate | ||
}) instantiateFunctionTypesAndProvideFreshTypeParameters( | ||
SharedFunctionTypeStructure<Type, TypeParameter, NamedFunctionParameter> | ||
p, | ||
SharedFunctionTypeStructure<Type, TypeParameter, NamedFunctionParameter> | ||
q, | ||
{required bool leftSchema}) { | ||
// TODO(paulberry): implement instantiateFunctionTypesAndProvideEliminator | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
void restoreState(TypeConstraintGeneratorState state) { | ||
constraints.length = state.count; | ||
} | ||
} |
Oops, something went wrong.