Skip to content

Commit b79b875

Browse files
committed
[ConstraintSystem] Make it possible to reference PotentialBinding(s) in unit tests
1 parent 25fff2c commit b79b875

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ class SolutionApplicationTarget;
6666

6767
} // end namespace constraints
6868

69-
namespace unittest {
70-
71-
class SemaTest;
72-
73-
} // end namespace unittest
74-
7569
// Forward declare some TypeChecker related functions
7670
// so they could be made friends of ConstraintSystem.
7771
namespace TypeChecker {
@@ -2026,8 +2020,6 @@ enum class SolutionApplicationToFunctionResult {
20262020
class ConstraintSystem {
20272021
ASTContext &Context;
20282022

2029-
friend class swift::unittest::SemaTest;
2030-
20312023
public:
20322024
DeclContext *DC;
20332025
ConstraintSystemOptions Options;
@@ -4625,7 +4617,8 @@ class ConstraintSystem {
46254617
ConstraintKind bodyResultConstraintKind,
46264618
ConstraintLocatorBuilder locator);
46274619

4628-
private:
4620+
public: // binding inference logic is public for unit testing.
4621+
46294622
/// The kind of bindings that are permitted.
46304623
enum class AllowedBindingKind : uint8_t {
46314624
/// Only the exact type.
@@ -4763,7 +4756,6 @@ class ConstraintSystem {
47634756
bool viableAsBinding() const { return !isCovered() && hasDefaultType(); }
47644757
};
47654758

4766-
private:
47674759
struct PotentialBindings {
47684760
using BindingScore =
47694761
std::tuple<bool, bool, bool, bool, bool, unsigned char, int>;
@@ -5157,7 +5149,6 @@ class ConstraintSystem {
51575149
Optional<Type> checkTypeOfBinding(TypeVariableType *typeVar, Type type) const;
51585150
Optional<PotentialBindings> determineBestBindings();
51595151

5160-
public:
51615152
/// Infer bindings for the given type variable based on current
51625153
/// state of the constraint system.
51635154
PotentialBindings inferBindingsFor(TypeVariableType *typeVar,

0 commit comments

Comments
 (0)