@@ -50,6 +50,17 @@ abstract interface class TypeAnalyzerOperations<Variable extends Object,
5050 /// Returns the unknown type schema (`_` ) used in type inference.
5151 SharedTypeSchemaView get unknownType;
5252
53+ TypeConstraintGenerator <Variable , TypeDeclarationType , TypeDeclaration ,
54+ Object >
55+ createTypeConstraintGenerator (
56+ {required TypeConstraintGenerationDataForTesting <Variable , Object >?
57+ typeConstraintGenerationDataForTesting,
58+ required List <SharedTypeParameterView > typeParametersToInfer,
59+ required TypeAnalyzerOperations <Variable , TypeDeclarationType ,
60+ TypeDeclaration >
61+ typeAnalyzerOperations,
62+ required bool inferenceUsingBoundsIsEnabled});
63+
5364 /// Returns the type `Future` with omitted nullability and type argument
5465 /// [argumentType] .
5566 ///
@@ -538,6 +549,20 @@ abstract interface class TypeAnalyzerOperations<Variable extends Object,
538549 SharedTypeSchemaView ? matchTypeSchemaFutureOr (
539550 SharedTypeSchemaView typeSchema);
540551
552+ MergedTypeConstraint <Variable , TypeDeclarationType , TypeDeclaration >
553+ mergeInConstraintsFromBound (
554+ {required SharedTypeParameter typeParameterToInfer,
555+ required List <SharedTypeParameterView > typeParametersToInfer,
556+ required SharedType lower,
557+ required Map <
558+ SharedTypeParameter ,
559+ MergedTypeConstraint <Variable , TypeDeclarationType ,
560+ TypeDeclaration >>
561+ inferencePhaseConstraints,
562+ required TypeConstraintGenerationDataForTesting <Variable , Object >?
563+ dataForTesting,
564+ required bool inferenceUsingBoundsIsEnabled});
565+
541566 /// Computes `NORM` of [type] .
542567 /// https://github.com/dart-lang/language
543568 /// See `resources/type-system/normalization.md`
@@ -671,31 +696,6 @@ abstract interface class TypeAnalyzerOperations<Variable extends Object,
671696 /// Returns [type] suffixed with the [suffix] .
672697 SharedType withNullabilitySuffixInternal (
673698 covariant SharedType type, NullabilitySuffix suffix);
674-
675- TypeConstraintGenerator <Variable , TypeDeclarationType , TypeDeclaration ,
676- Object >
677- createTypeConstraintGenerator (
678- {required TypeConstraintGenerationDataForTesting <Variable , Object >?
679- typeConstraintGenerationDataForTesting,
680- required List <SharedTypeParameterView > typeParametersToInfer,
681- required TypeAnalyzerOperations <Variable , TypeDeclarationType ,
682- TypeDeclaration >
683- typeAnalyzerOperations,
684- required bool inferenceUsingBoundsIsEnabled});
685-
686- MergedTypeConstraint <Variable , TypeDeclarationType , TypeDeclaration >
687- mergeInConstraintsFromBound (
688- {required SharedTypeParameter typeParameterToInfer,
689- required List <SharedTypeParameterView > typeParametersToInfer,
690- required SharedType lower,
691- required Map <
692- SharedTypeParameter ,
693- MergedTypeConstraint <Variable , TypeDeclarationType ,
694- TypeDeclaration >>
695- inferencePhaseConstraints,
696- required TypeConstraintGenerationDataForTesting <Variable , Object >?
697- dataForTesting,
698- required bool inferenceUsingBoundsIsEnabled});
699699}
700700
701701mixin TypeAnalyzerOperationsMixin <Variable extends Object ,
@@ -810,66 +810,6 @@ mixin TypeAnalyzerOperationsMixin<Variable extends Object,
810810 ? .wrapSharedTypeSchemaView ();
811811 }
812812
813- @override
814- SharedTypeView recordType (
815- {required List <SharedTypeView > positional,
816- required List <(String , SharedTypeView )> named}) {
817- return new SharedTypeView (recordTypeInternal (
818- positional: positional.cast <SharedType >(),
819- named: named.cast< (String , SharedType )> ()));
820- }
821-
822- @override
823- SharedTypeSchemaView recordTypeSchema (
824- {required List <SharedTypeSchemaView > positional,
825- required List <(String , SharedTypeSchemaView )> named}) {
826- return new SharedTypeSchemaView (recordTypeInternal (
827- positional: positional.cast <SharedType >(),
828- named: named.cast< (String , SharedType )> ()));
829- }
830-
831- @override
832- bool typeIsSubtypeOfTypeSchema (
833- SharedTypeView leftType, SharedTypeSchemaView rightSchema) {
834- return isSubtypeOfInternal (
835- leftType.unwrapTypeView (), rightSchema.unwrapTypeSchemaView ());
836- }
837-
838- @override
839- SharedTypeSchemaView typeSchemaGlb (
840- SharedTypeSchemaView typeSchema1, SharedTypeSchemaView typeSchema2) {
841- return new SharedTypeSchemaView (glbInternal (
842- typeSchema1.unwrapTypeSchemaView (),
843- typeSchema2.unwrapTypeSchemaView ()));
844- }
845-
846- @override
847- bool typeSchemaIsSubtypeOfType (
848- SharedTypeSchemaView leftSchema, SharedTypeView rightType) {
849- return isSubtypeOfInternal (
850- leftSchema.unwrapTypeSchemaView (), rightType.unwrapTypeView ());
851- }
852-
853- @override
854- bool typeSchemaIsSubtypeOfTypeSchema (
855- SharedTypeSchemaView leftSchema, SharedTypeSchemaView rightSchema) {
856- return isSubtypeOfInternal (
857- leftSchema.unwrapTypeSchemaView (), rightSchema.unwrapTypeSchemaView ());
858- }
859-
860- @override
861- SharedTypeSchemaView typeSchemaLub (
862- SharedTypeSchemaView typeSchema1, SharedTypeSchemaView typeSchema2) {
863- return new SharedTypeSchemaView (lubInternal (
864- typeSchema1.unwrapTypeSchemaView (),
865- typeSchema2.unwrapTypeSchemaView ()));
866- }
867-
868- @override
869- SharedTypeSchemaView typeToSchema (SharedTypeView type) {
870- return new SharedTypeSchemaView (type.unwrapTypeView ());
871- }
872-
873813 @override
874814 MergedTypeConstraint <Variable , TypeDeclarationType , TypeDeclaration >
875815 mergeInConstraintsFromBound (
@@ -945,6 +885,66 @@ mixin TypeAnalyzerOperationsMixin<Variable extends Object,
945885 }
946886 return constraintsPerTypeVariable[typeParameterToInfer]! ;
947887 }
888+
889+ @override
890+ SharedTypeView recordType (
891+ {required List <SharedTypeView > positional,
892+ required List <(String , SharedTypeView )> named}) {
893+ return new SharedTypeView (recordTypeInternal (
894+ positional: positional.cast <SharedType >(),
895+ named: named.cast< (String , SharedType )> ()));
896+ }
897+
898+ @override
899+ SharedTypeSchemaView recordTypeSchema (
900+ {required List <SharedTypeSchemaView > positional,
901+ required List <(String , SharedTypeSchemaView )> named}) {
902+ return new SharedTypeSchemaView (recordTypeInternal (
903+ positional: positional.cast <SharedType >(),
904+ named: named.cast< (String , SharedType )> ()));
905+ }
906+
907+ @override
908+ bool typeIsSubtypeOfTypeSchema (
909+ SharedTypeView leftType, SharedTypeSchemaView rightSchema) {
910+ return isSubtypeOfInternal (
911+ leftType.unwrapTypeView (), rightSchema.unwrapTypeSchemaView ());
912+ }
913+
914+ @override
915+ SharedTypeSchemaView typeSchemaGlb (
916+ SharedTypeSchemaView typeSchema1, SharedTypeSchemaView typeSchema2) {
917+ return new SharedTypeSchemaView (glbInternal (
918+ typeSchema1.unwrapTypeSchemaView (),
919+ typeSchema2.unwrapTypeSchemaView ()));
920+ }
921+
922+ @override
923+ bool typeSchemaIsSubtypeOfType (
924+ SharedTypeSchemaView leftSchema, SharedTypeView rightType) {
925+ return isSubtypeOfInternal (
926+ leftSchema.unwrapTypeSchemaView (), rightType.unwrapTypeView ());
927+ }
928+
929+ @override
930+ bool typeSchemaIsSubtypeOfTypeSchema (
931+ SharedTypeSchemaView leftSchema, SharedTypeSchemaView rightSchema) {
932+ return isSubtypeOfInternal (
933+ leftSchema.unwrapTypeSchemaView (), rightSchema.unwrapTypeSchemaView ());
934+ }
935+
936+ @override
937+ SharedTypeSchemaView typeSchemaLub (
938+ SharedTypeSchemaView typeSchema1, SharedTypeSchemaView typeSchema2) {
939+ return new SharedTypeSchemaView (lubInternal (
940+ typeSchema1.unwrapTypeSchemaView (),
941+ typeSchema2.unwrapTypeSchemaView ()));
942+ }
943+
944+ @override
945+ SharedTypeSchemaView typeToSchema (SharedTypeView type) {
946+ return new SharedTypeSchemaView (type.unwrapTypeView ());
947+ }
948948}
949949
950950/// Abstract interface of a type constraint generator.
@@ -991,6 +991,11 @@ abstract class TypeConstraintGenerator<
991991 covariant SharedTypeParameter typeParameter, covariant SharedType upper,
992992 {required AstNode ? astNodeForTesting});
993993
994+ /// Returns the set of type constraints that was gathered.
995+ Map <SharedTypeParameter ,
996+ MergedTypeConstraint <Variable , TypeDeclarationType , TypeDeclaration >>
997+ computeConstraints ();
998+
994999 /// Iterates over all of the type constraints generated since
9951000 /// [eliminationStartState] and eliminates the type variables in them using
9961001 /// [typeParametersToEliminate] .
@@ -1864,11 +1869,6 @@ abstract class TypeConstraintGenerator<
18641869
18651870 return false ;
18661871 }
1867-
1868- /// Returns the set of type constraints that was gathered.
1869- Map <SharedTypeParameter ,
1870- MergedTypeConstraint <Variable , TypeDeclarationType , TypeDeclaration >>
1871- computeConstraints ();
18721872}
18731873
18741874mixin TypeConstraintGeneratorMixin <
0 commit comments